#include <typedefs.h>
#include <error.h>
#include <p_wkfile.h>
#include <p_status.h>
#include <math.h>
#include <pcb_defs.h>
#include <list_mgmt.h>
#include <keyboard.h>
#include "proto.h"
#include "p_tcomp.h"
#include "p_150.h"

#define INLET_EEPROM_SIZE 256
#define EEPROM_DEF_SIZE    27

#define D_DT DEFAULT_DT
#define D_DV (U_INT16)DEFAULT_DV
#define D_25 DEFAULT_V25C
#define V_INLT REQUIRED_INLET_VERSION




/**begin_proto**/

#define I_TERM_INDEX  0
#define P_TERM_INDEX  1
#define D_TERM_INDEX  2
#define NL_TERM_INDEX 3

#define PRES_CHANNEL  0
#define FLOW_CHANNEL  1
#define ALT_CHANNEL   2

/**end_proto**/

const struct { U_INT16 value; BIT8 definition[EEPROM_DEF_SIZE];} Inlet_EEPROM_Default [INLET_EEPROM_SIZE] = {
/*#!inc_addr*/

   /* standard header */
        /* ----+----1----+----2----+-               ----+----1----+----2----+-               ----+----1----+----2----+-*/
{ 0x0000, "00 Module Checksum        " },{ V_INLT, "01 Version   U.F          " },{ 0x0000, "02 Module_Type            " },
{ 0xc282, "03 Build Date             " },{ 0x0000, "04 Serial Number High     " },{ 0x0001, "05 Serial Number Low      " },
{ D_DV,   "06 Thermistor delta volts " },{ D_DT,   "07 Thermistor delta temp  " },{ D_25,   "08 Thermistor V 25C       " },

   /* sensor definitions  */

{ 0x0001, "09 P Sensor Range         " },{ 0x0000, "0a F Sensor Range         " },{ 0x0001, "0b P Sesnor Range (Alt)   " },
{ 0x3333, "0c Fact PS 25C Offset     " },{ 0x0000, "0d                        " },{ 0x0000, "0e                        " },
{ 0x0000, "0f Fact PS dOffset/dT     " },{ 0x0000, "10                        " },{ 0x0000, "11                        " },
{ 0x9999, "12 Fact PS Span           " },{ 0x0000, "13                        " },{ 0x0000, "14                        " },
{ 0x0000, "15 Fact PS dSpan/dT       " },{ 0x0000, "16 AutoZero 20mS Tics     " },{ 0x0000, "17                        " },

   /* internal unit scalings */

{ 0x00a0, "18 Pres Scaling dynes/cm^2" },{ 0x000e, "19                        " },{ 0x00a0, "1a Alt Pres Scaling d/cm2 " },
{ 0x0000, "1b                        " },{ 0x000e, "1c Flow Scaling #Bits   FS" },{ 0x0008, "1d Flow Scaling #Bits  SPR" },

   /* user calib  */

{ 0x0000, "1e User Calib State       " },{ 0x0000, "1f User Calib Date1       " },{ 0x0000, "20 User Calib Date2       " },
{ 0x0000, "21 User P Calib Offset    " },{ 0x0000, "22 User F Calib Offset    " },{ 0x0000, "23 User PR Calib Offset   " },
{ 0x4000, "24 User P Calib Gain      " },{ 0x4000, "25 User F Calib Gain      " },{ 0x4000, "26 User PR Calib Gain     " },
{ 0x0000, "27 User P Calib Pres      " },{ 0x0000, "28 User F Calib Flow      " },{ 0x0000, "29 User PR Calib Flow     " },

   /* factory calib  */

{ 0x4000, "2a Fact PS Pres Gain      " },{ 0x4000, "2b                        " },{ 0x4000, "2c                        " },
{ 0x0000, "2d Fact PS Calib Offset   " },{ 0x0000, "2e                        " },{ 0x0000, "2f                        " },

   /* factory pid terms follow ... */

/*                                                                                                                     */
/*  Working PIDs that actively manage the Nutronics inlet manifold valve control loops vary with PCB2 control mode     */
/*  ( i.e. FF,FP,FFBP ) , AND with flow and/or pressure setpoints.                                                     */
/*                                                                                                                     */
/*  Non linear correction operates ONLY for FWD_FLOW+BACK_PRES inlet mode; otherwise, in PCB2, working_pids are        */
/*  same as down_load_pids.  "NLgf" is the NonLinear control term to manage gain non-linearity in the flow loop.       */
/*  "NLgp" is the non-linear term to manage gain non-linearity in the pressure loop.  "NLb" is the NonLinear control   */
/*  term to manage band-width non-linearity in the pressure (only) loop.                                               */
/*                                                                                                                     */
/*  The IQ epc pneu "plant" has 2 fundamentally independant non-linearities:                                           */
/*    1/ Plant gain of delta_delivered_flow vs delta_Nutronics% increases with flow  setpoint                          */
/*    2/ Plant BW of delta_pressure vs delta_Nutronics% increases with pressure setpoint                               */
/*                                                                                                                     */
/*  Mode <> FFBP ( NO compensation in this case ; NLb,NLgf,NLp = dont'care )                                            */
/*  ===============================================================================================                    */
/*                                                                                                                     */
/*      Mode=FP:                                                                                                       */
/*           working_FwdPRES_pids <- Column1_pids(gas_type)                                                            */
/*           ( FLOW loop is idle )                                                                                     */
/*                                                                                                                     */
/*      Mode=FF:                                                                                                       */
/*           ( PRES loop is idle )                                                                                     */
/*           working_FwdFLOW_pids  <- Column2_pids(gas_type)                                                           */
/*                                                                                                                     */
/*                                                                                                                     */
/*  Mode = "FFBP":  "f()" and "g()" compensate  for "1/" by varying pids as NLgp,NLgf and Flow_Setpt vary:             */
/*                            "h()" compensates for "2/" by varying pids as NLb and Pres_Setpt vary:                   */
/*  =====================================================================================================              */
/*                                                                                                                     */
/*  First GAIN variation on pres and flow loops is compensated & BW is not touched:                                    */
/*                                                                                                                     */
/*             temp_BackPRES_pids <- f(Column3_pids(gas_type), NLgp, flow_setpt/flow_full_scale )                      */
/*           working_FwdFLOW_pids <- g(Column2_pids(gas_type), NLgf, flow_setpt/flow_full_scale )                      */
/*                                                                                                                     */
/*           where f() and g() return attenuated versions of Column3 and Column2 pids ;  .14 <= attn_factor <= 1.0     */
/*                                                                                                                     */
/*  Next BW variation on the pres loop is compensated; gain is NOT effected                                            */
/*                                                                                                                     */
/*           working_BackPRES_pids <- h(temp_BackPRES_pids(gas_type), NLb, pres_setpt/pres_full_scale )                */
/*                                                                                                                     */
/*           where h() operates as follows:                                                                            */
/*                                                                                                                     */
/*             P_out = P_in                                                                                            */
/*             I_out = I_in * Corr_factor                                                                              */
/*             D_out = D_in / Corr_factor                                                                              */
/*                                                                                                                     */
/*             Corr_factor  = fn( pres_setpt/pres_full_scale ,  NLb )                                                  */
/*                         >= 0.0                                                                                      */
/*                         <= 1.0                                                                                      */
/*                                                                                                                     */
/* Note:                                                                                                               */
/*  1/ The order of operation for executing "f() g()"  vs "h()" does NOT matter; i.e. GAIN compensation can            */
/*     either preceed or follow BW compensaation and working_pids will get the same results.                           */
/*                                                                                                                     */


/* PRES_loop PIDs: FWD_PRES,no flow            FLOW_loop PIDs: anytime               PRES_loop PIDs: FWD_FLOW+BACK_PRES */
/* ----------------------------------       ----------------------------------       ---------------------------------- */
/*                                                                                                                      */
{ 0xffff, "30 Fact   N2      Pres  I " },{ 0xffff, "31 Fact  N2/ Air Flow  I  " },{ 0xffff, "32 Fact   N2      Alt  I  " },
{ 0xffff, "33 Fact   N2      Pres  P " },{ 0xffff, "34 Fact  N2/ Air Flow  P  " },{ 0xffff, "35 Fact   N2      Alt  P  " },
{ 0xffff, "36 Fact   N2      Pres  D " },{ 0xffff, "37 Fact  N2/ Air Flow  D  " },{ 0xffff, "38 Fact   N2      Alt  D  " },
{ 0xffff, "39 Fact   N2      Pres NLb" },{ 0xffff, "3a Fact  N2/ Air Flow NLgf" },{ 0xffff, "3b Fact   N2      Alt NLgp" },

{ 0xffff, "3c Fact   H2      Pres  I " },{ 0xffff, "3d Fact  H2      Flow  I  " },{ 0xffff, "3e Fact   H2      Alt  I  " },
{ 0xffff, "3f Fact   H2      Pres  P " },{ 0xffff, "40 Fact  H2      Flow  P  " },{ 0xffff, "41 Fact   H2      Alt  P  " },
{ 0xffff, "42 Fact   H2      Pres  D " },{ 0xffff, "43 Fact  H2      Flow  D  " },{ 0xffff, "44 Fact   H2      Alt  D  " },
{ 0xffff, "45 Fact   H2      Pres NLb" },{ 0xffff, "46 Fact  H2      Flow NLgf" },{ 0xffff, "47 Fact   H2      Alt NLgp" },

{ 0xffff, "48 Fact   He      Pres  I " },{ 0xffff, "49 Fact  He/  O2 Flow  I  " },{ 0xffff, "4a Fact   He      Alt  I  " },
{ 0xffff, "4b Fact   He      Pres  P " },{ 0xffff, "4c Fact  He/  O2 Flow  P  " },{ 0xffff, "4d Fact   He      Alt  P  " },
{ 0xffff, "4e Fact   He      Pres  D " },{ 0xffff, "4f Fact  He/  O2 Flow  D  " },{ 0xffff, "50 Fact   He      Alt  D  " },
{ 0xffff, "51 Fact   He      Pres NLb" },{ 0xffff, "52 Fact  He/  O2 Flow NLgf" },{ 0xffff, "53 Fact   He      Alt NLgp" },

{ 0xffff, "54 Fact ArMe      Pres  I " },{ 0xffff, "55 Fact ArMe/ Ar Flow  I  " },{ 0xffff, "56 Fact ArMe/ Ar  Alt  I  " },
{ 0xffff, "57 Fact ArMe      Pres  P " },{ 0xffff, "58 Fact ArMe/ Ar Flow  P  " },{ 0xffff, "59 Fact ArMe/ Ar  Alt  P  " },
{ 0xffff, "5a Fact ArMe      Pres  D " },{ 0xffff, "5b Fact ArMe/ Ar Flow  D  " },{ 0xffff, "5c Fact ArMe/ Ar  Alt  D  " },
{ 0xffff, "5d Fact ArMe      Pres NLb" },{ 0xffff, "5e Fact ArMe/ Ar Flow NLgf" },{ 0xffff, "5f Fact ArMe/ Ar  Alt NLgp" },

   /* user pid terms */

{ 0xffff, "60 User   N2      Pres  Ib" },{ 0xffff, "61 User  N2/ Air Flow  I  " },{ 0xffff, "62 User   N2      Alt  I  " },
{ 0xffff, "63 User   N2      Pres  Pb" },{ 0xffff, "64 User  N2/ Air Flow  P  " },{ 0xffff, "65 User   N2      Alt  P  " },
{ 0xffff, "66 User   N2      Pres  Db" },{ 0xffff, "67 User  N2/ Air Flow  D  " },{ 0xffff, "68 User   N2      Alt  D  " },
{ 0xffff, "69 User   N2      Pres NLb" },{ 0xffff, "6a User  N2/ Air Flow NLgf" },{ 0xffff, "6b User   N2      Alt NLgp" },

{ 0xffff, "6c User   H2      Pres  Ib" },{ 0xffff, "6d User  H2      Flow  I  " },{ 0xffff, "6e User   H2      Alt  I  " },
{ 0xffff, "6f User   H2      Pres  Pb" },{ 0xffff, "70 User  H2      Flow  P  " },{ 0xffff, "71 User   H2      Alt  P  " },
{ 0xffff, "72 User   H2      Pres  Db" },{ 0xffff, "73 User  H2      Flow  D  " },{ 0xffff, "74 User   H2      Alt  D  " },
{ 0xffff, "75 User   H2      Pres NLb" },{ 0xffff, "76 User  H2      Flow NLgf" },{ 0xffff, "77 User   H2      Alt NLgp" },

{ 0xffff, "78 User   He      Pres  Ib" },{ 0xffff, "79 User  He/  O2 Flow  I  " },{ 0xffff, "7a User   He      Alt  I  " },
{ 0xffff, "7b User   He      Pres  Pb" },{ 0xffff, "7c User  He/  O2 Flow  P  " },{ 0xffff, "7d User   He      Alt  P  " },
{ 0xffff, "7e User   He      Pres  Db" },{ 0xffff, "7f User  He/  O2 Flow  D  " },{ 0xffff, "80 User   He      Alt  D  " },
{ 0xffff, "81 User   He      Pres NLb" },{ 0xffff, "82 User  He/  O2 Flow NLgf" },{ 0xffff, "83 User   He      Alt NLgp" },

{ 0xffff, "84 User ArMe      Pres  Ib" },{ 0xffff, "85 User ArMe/ Ar Flow  I  " },{ 0xffff, "86 User ArMe/  Ar  Alt  I " },
{ 0xffff, "87 User ArMe      Pres  Pb" },{ 0xffff, "88 User ArMe/ Ar Flow  P  " },{ 0xffff, "89 User ArMe/  Ar  Alt  P " },
{ 0xffff, "8a User ArMe      Pres  Db" },{ 0xffff, "8b User ArMe/ Ar Flow  D  " },{ 0xffff, "8c User ArMe/  Ar  Alt  D " },
{ 0xffff, "8d User ArMe      Pres NLb" },{ 0xffff, "8e User ArMe/ Ar Flow NLgf" },{ 0xffff, "8f User ArMe/  Ar  Alt NLb" },


   /* gas dependent flow sensor parameters  */

{ 0x328a, "90 H2 Alpha/2     Low Flow" },{ 0x06c6, "91 H2 Beta        Low Flow" },{ 0x00af, "92 H2 High/Low Switch Flow" },
{ 0x4300, "93 H2 Alpha/2     High Flo" },{ 0x04eb, "94 H2 Beta        High Flo" },{ 0x0952, "95 H2 Offset              " },
{ 0x0001, "96 H2 dAlpha/dT           " },{ 0x0002, "97 H2 dBeta/dT            " },{ 0x0003, "98 H2 dOffset/dT          " },
{ 0x4a89, "99 H2 Reference Temp      " },{ 0x0000, "9a H2 Septum Purge Flow   " },{ 0x0000, "9b H2 dPurgeFlow/dPres    " },
{ 0x0000, "9c H2 Max Inlet Flow      " },{ 0x0000, "9d H2 Calib T1 oC * 100   " },{ 0x0000, "9e H2 Calib T2 oC * 100   " },

{ 0x2949, "9f He Alpha/2     Low Flow" },{ 0x074c, "a0 He Beta        Low Flow" },{ 0x00af, "a1 He High/Low Switch Flow" },
{ 0x3fd6, "a2 He Alpha/2     High Flo" },{ 0x047d, "a3 He Beta        High Flo" },{ 0x0935, "a4 He Offset              " },
{ 0x0001, "a5 He dAlpha/dT           " },{ 0x0002, "a6 He dBeta/dT            " },{ 0x0003, "a7 He dOffset/dT          " },
{ 0x4a89, "a8 He Reference Temp      " },{ 0x0000, "a9 He Septum Purge Flow   " },{ 0x0000, "aa He dPurgeFlow/dPres    " },
{ 0x0000, "ab He Max Inlet Flow      " },{ 0x0000, "ac H2 Calib T1 oC * 100   " },{ 0x0000, "ad He Calib T2 oC * 100   " },

{ 0x4148, "ae ArMe Alpha/2   Low Flow" },{ 0x1e8a, "af ArMe Beta      Low Flow" },{ 0xffff, "b0 ArMe High/Low Switch Fl" },
{ 0x0000, "b1 ArMe Alpha/2   High Flo" },{ 0x0000, "b2 ArMe Beta      High Flo" },{ 0x0879, "b3 ArMe Offset            " },
{ 0x0001, "b4 ArMe dAlpha/dT         " },{ 0x0002, "b5 ArMe dBeta/dT          " },{ 0x0003, "b6 ArMe dOffset/dT        " },
{ 0x4a89, "b7 ArMe Reference Temp    " },{ 0x0000, "b8 ArMe Septum Purge Flow " },{ 0x0000, "b9 ArMe dPurgeFlow/dPres  " },
{ 0x0000, "ba ArMe Max Inlet Flow    " },{ 0x0000, "bb ArMe Calib T1 oC * 100 " },{ 0x0000, "bc ArMe Calib T2 oC * 100 " },

{ 0x2ee6, "bd N2 Alpha/2     Low Flow" },{ 0x2bf2, "be N2 Beta        Low Flow" },{ 0x0064, "bf N2 High/Low Switch Flow" },
{ 0x3f40, "c0 N2 Alpha/2     High Flo" },{ 0x1e05, "c1 N2 Beta        High Flo" },{ 0x0879, "c2 N2 Offset              " },
{ 0x0001, "c3 N2 dAlpha/dT           " },{ 0x0002, "c4 N2 dBeta/dT            " },{ 0x0003, "c5 N2 dOffset/dT          " },
{ 0x4a89, "c6 N2 Reference Temp      " },{ 0x0000, "c7 N2 Septum Purge Flow   " },{ 0x0000, "c8 N2 dPurgeFlow/dPres    " },
{ 0x0000, "c9 N2 Max Inlet Flow      " },{ 0x0000, "ca N2 Calib T1 oC * 100   " },{ 0x0000, "cb N2 Calib T2 oC * 100   " },


   /* these words are used to save the voltages from the tpzf commands for drift studies  */
   /* or to recreate parms on the fly.   the first value in the label is the tpzf meaning */

{ 0x0000, "cc H2 ref_flow * 100  sccm" },{ 0x0000, "cd H2 V0_T1               " },{ 0x0000, "ce H2 V1_T1               " },
{ 0x0000, "cf H2 V3_T1               " },{ 0x0000, "d0 H2 V9_T1               " },{ 0x0000, "d1 H2 V0_T2               " },
{ 0x0000, "d2 H2 V1_T2               " },{ 0x0000, "d3 H2 V3_T2               " },{ 0x0000, "d4 H2 V9_T2               " },

{ 0x0000, "d5 He ref_flow * 100  sccm" },{ 0x0000, "d6 He V0_T1               " },{ 0x0000, "d7 He V1_T1               " },
{ 0x0000, "d8 He V3_T1               " },{ 0x0000, "d9 He V9_T1               " },{ 0x0000, "da He V0_T2               " },
{ 0x0000, "db He V1_T2               " },{ 0x0000, "dc He V3_T2               " },{ 0x0000, "dd He V9_T2               " },

{ 0x0000, "de ArMe ref_flow*100  sccm" },{ 0x0000, "df ArMe V0_T1             " },{ 0x0000, "e0 ArMe V1_T1             " },
{ 0x0000, "e1 ArMe V3_T1             " },{ 0x0000, "e2 ArMe V9_T1             " },{ 0x0000, "e3 ArMe V0_T2             " },
{ 0x0000, "e4 ArMe V1_T2             " },{ 0x0000, "e5 ArMe V3_T2             " },{ 0x0000, "e6 ArMe V9_T2             " },

{ 0x0000, "e7 N2 ref_flow * 100  sccm" },{ 0x0000, "e8 N2 V0_T1               " },{ 0x0000, "e9 N2 V1_T1               " },
{ 0x0000, "ea N2 V3_T1               " },{ 0x0000, "eb N2 V9_T1               " },{ 0x0000, "ec N2 V0_T2               " },
{ 0x0000, "ed N2 V1_T2               " },{ 0x0000, "ee N2 V3_T2               " },{ 0x0000, "ef N2 V9_T2               " },


   /* Flow Sensor Auto Zero Offsets */

{ 0x0000, "f0 N2 Auto Zero Offset    " },{ 0x0000, "f1 H2 Auto Zero Offset    " },{ 0x0000, "f2 He Auto Zero Offset    " },
{ 0x0000, "f3 ArMe Auto Zero Offset  " },{ 0x0000, "f4                        " },{ 0x0000, "f5                        " },


  /* thermal */
{ 0x0000, "f6 Thermal1: P, I         " },{ 0x0000, "f7 Thermal2: D, minTemp   " },{ 0x0000, "f8 Thermal3:maxT,snsr,freq" },
{ 0x0000, "f9 Thermal4: rate,cyo,conf" },{ 0x0000, "fa Thermal5: div-P,I,D    " },{ 0x0000, "fb Thermal6: CtlErr,IntPwr" },


  /* inlet title */
{ 0x0000, "fc inlet title bytes 0,1  " },{ 0x0000, "fd inlet title bytes 2,3  " },{ 0x0000, "fe inlet title bytes 4,5  " },

{ 0x0000, "ff Test Station ID Number " }

/*#!inc_addr*/




 };



const struct { U_INT16 value; BIT8 definition[EEPROM_DEF_SIZE];} Jill_EEPROM_Default [INLET_EEPROM_SIZE] = {
/*#!inc_addr*/

   /* standard header */
        /* ----+----1----+----2----+-               ----+----1----+----2----+-               ----+----1----+----2----+-*/
{ 0x0000, "00 Module Checksum        " },{ V_INLT, "01 Version   U.F          " },{ 0x0000, "02 Module_Type            " },
{ 0xc282, "03 Build Date             " },{ 0x0000, "04 Serial Number High     " },{ 0x0001, "05 Serial Number Low      " },
{ D_DV,   "06 Thermistor delta volts " },{ D_DT,   "07 Thermistor delta temp  " },{ D_25,   "08 Thermistor V 25C       " },

   /* sensor definitions  */

{ 0x0001, "09 P Sensor Range         " },{ 0x0000, "0a F Sensor Range         " },{ 0x0001, "0b P Sesnor Range (Alt)   " },
{ 0x3333, "0c Fact PS 25C Offset     " },{ 0x0000, "0d                        " },{ 0x0000, "0e                        " },
{ 0x0000, "0f Fact PS dOffset/dT     " },{ 0x0000, "10                        " },{ 0x0000, "11                        " },
{ 0x9999, "12 Fact PS Span           " },{ 0x0000, "13                        " },{ 0x0000, "14                        " },
{ 0x0000, "15 Fact PS dSpan/dT       " },{ 0x0000, "16                        " },{ 0x0000, "17                        " },

   /* internal unit scalings */

{ 0x00a0, "18 Pres Scaling dynes/cm^2" },{ 0x000e, "19                        " },{ 0x00a0, "1a Alt Pres Scaling d/cm2 " },
{ 0x0000, "1b                        " },{ 0x000e, "1c Flow Scaling #Bits   FS" },{ 0x0008, "1d Flow Scaling #Bits  SPR" },

   /* factory pid terms */

{ 0xffff, "1e Fact   N2      Pres  I " },{ 0xffff, "1f Fact   N2      Flow  I " },{ 0xffff, "20 Fact   N2       Alt  I " },
{ 0xffff, "21 Fact   N2      Pres  P " },{ 0xffff, "22 Fact   N2      Flow  P " },{ 0xffff, "23 Fact   N2       Alt  P " },
{ 0xffff, "24 Fact   N2      Pres  D " },{ 0xffff, "25 Fact   N2      Flow  D " },{ 0xffff, "26 Fact   N2       Alt  D " },
{ 0xffff, "27 Fact   N2      Pres NL " },{ 0xffff, "28 Fact   N2      Flow NL " },{ 0xffff, "29 Fact   N2       Alt NL " },

{ 0xffff, "2a Fact   H2      Pres  I " },{ 0xffff, "2b Fact   H2      Flow  I " },{ 0xffff, "2c Fact   H2       Alt  I " },
{ 0xffff, "2d Fact   H2      Pres  P " },{ 0xffff, "2e Fact   H2      Flow  P " },{ 0xffff, "2f Fact   H2       Alt  P " },
{ 0xffff, "30 Fact   H2      Pres  D " },{ 0xffff, "31 Fact   H2      Flow  D " },{ 0xffff, "32 Fact   H2       Alt  D " },
{ 0xffff, "33 Fact   H2      Pres NL " },{ 0xffff, "34 Fact   H2      Flow NL " },{ 0xffff, "35 Fact   H2       Alt NL " },

{ 0xffff, "36 Fact   He      Pres  I " },{ 0xffff, "37 Fact   He      Flow  I " },{ 0xffff, "38 Fact   He       Alt  I " },
{ 0xffff, "39 Fact   He      Pres  P " },{ 0xffff, "3a Fact   He      Flow  P " },{ 0xffff, "3b Fact   He       Alt  P " },
{ 0xffff, "3c Fact   He      Pres  D " },{ 0xffff, "3d Fact   He      Flow  D " },{ 0xffff, "3e Fact   He       Alt  D " },
{ 0xffff, "3f Fact   He      Pres NL " },{ 0xffff, "40 Fact   He      Flow NL " },{ 0xffff, "41 Fact   He       Alt NL " },

{ 0xffff, "42 Fact ArMe      Pres  I " },{ 0xffff, "43 Fact ArMe      Flow  I " },{ 0xffff, "44 Fact ArMe       Alt  I " },
{ 0xffff, "45 Fact ArMe      Pres  P " },{ 0xffff, "46 Fact ArMe      Flow  P " },{ 0xffff, "47 Fact ArMe       Alt  P " },
{ 0xffff, "48 Fact ArMe      Pres  D " },{ 0xffff, "49 Fact ArMe      Flow  D " },{ 0xffff, "4a Fact ArMe       Alt  D " },
{ 0xffff, "4b Fact ArMe      Pres NL " },{ 0xffff, "4c Fact ArMe      Flow NL " },{ 0xffff, "4d Fact ArMe       Alt NL " },

{ 0xffff, "4e Fact   O2      Pres  I " },{ 0xffff, "4f Fact   O2      Flow  I " },{ 0xffff, "50 Fact   O2       Alt  I " },
{ 0xffff, "51 Fact   O2      Pres  P " },{ 0xffff, "52 Fact   O2      Flow  P " },{ 0xffff, "53 Fact   O2       Alt  P " },
{ 0xffff, "54 Fact   O2      Pres  D " },{ 0xffff, "55 Fact   O2      Flow  D " },{ 0xffff, "56 Fact   O2       Alt  D " },
{ 0xffff, "57 Fact   O2      Pres NL " },{ 0xffff, "58 Fact   O2      Flow NL " },{ 0xffff, "59 Fact   O2       Alt NL " },

{ 0xffff, "5a Fact  Air      Pres  I " },{ 0xffff, "5b Fact  Air      Flow  I " },{ 0xffff, "5c Fact  Air       Alt  I " },
{ 0xffff, "5d Fact  Air      Pres  P " },{ 0xffff, "5e Fact  Air      Flow  P " },{ 0xffff, "5f Fact  Air       Alt  P " },
{ 0xffff, "60 Fact  Air      Pres  D " },{ 0xffff, "61 Fact  Air      Flow  D " },{ 0xffff, "62 Fact  Air       Alt  D " },
{ 0xffff, "63 Fact  Air      Pres NL " },{ 0xffff, "64 Fact  Air      Flow NL " },{ 0xffff, "65 Fact  Air       Alt NL " },

   /* gas dependent flow sensor parameters  */

{ 0x328a, "66 H2 Alpha/2     Low Flow" },{ 0x06c6, "67 H2 Beta        Low Flow" },{ 0x00af, "68 H2 High/Low Switch Flow" },
{ 0x4300, "69 H2 Alpha/2     High Flo" },{ 0x04eb, "6a H2 Beta        High Flo" },{ 0x0952, "6b H2 Offset              " },
{ 0x0001, "6c H2 dAlpha/dT           " },{ 0x0002, "6d H2 dBeta/dT            " },{ 0x0003, "6e H2 dOffset/dT          " },
{ 0x4a89, "6f H2 Reference Temp      " },{ 0x0000, "70 H2 Septum Purge Flow   " },{ 0x0000, "71 H2 dPurgeFlow/dPres    " },
{ 0x0000, "72 H2 Max Inlet Flow      " },{ 0x0000, "73 H2 Calib T1 oC * 100   " },{ 0x0000, "74 H2 Calib T2 oC * 100   " },

{ 0x2949, "75 He Alpha/2     Low Flow" },{ 0x074c, "76 He Beta        Low Flow" },{ 0x00af, "77 He High/Low Switch Flow" },
{ 0x3fd6, "78 He Alpha/2     High Flo" },{ 0x047d, "79 He Beta        High Flo" },{ 0x0935, "7a He Offset              " },
{ 0x0001, "7b He dAlpha/dT           " },{ 0x0002, "7c He dBeta/dT            " },{ 0x0003, "7d He dOffset/dT          " },
{ 0x4a89, "7e He Reference Temp      " },{ 0x0000, "7f He Septum Purge Flow   " },{ 0x0000, "80 He dPurgeFlow/dPres    " },
{ 0x0000, "81 He Max Inlet Flow      " },{ 0x0000, "82 H2 Calib T1 oC * 100   " },{ 0x0000, "83 He Calib T2 oC * 100   " },

{ 0x4148, "84 ArMe Alpha/2   Low Flow" },{ 0x1e8a, "85 ArMe Beta      Low Flow" },{ 0xffff, "86 ArMe High/Low Switch Fl" },
{ 0x0000, "87 ArMe Alpha/2   High Flo" },{ 0x0000, "88 ArMe Beta      High Flo" },{ 0x0879, "89 ArMe Offset            " },
{ 0x0001, "8a ArMe dAlpha/dT         " },{ 0x0002, "8b ArMe dBeta/dT          " },{ 0x0003, "8c ArMe dOffset/dT        " },
{ 0x4a89, "8d ArMe Reference Temp    " },{ 0x0000, "8e ArMe Septum Purge Flow " },{ 0x0000, "8f ArMe dPurgeFlow/dPres  " },
{ 0x0000, "90 ArMe Max Inlet Flow    " },{ 0x0000, "91 ArMe Calib T1 oC * 100 " },{ 0x0000, "92 ArMe Calib T2 oC * 100 " },

{ 0x2ee6, "93 N2 Alpha/2     Low Flow" },{ 0x2bf2, "94 N2 Beta        Low Flow" },{ 0x0064, "95 N2 High/Low Switch Flow" },
{ 0x3f40, "96 N2 Alpha/2     High Flo" },{ 0x1e05, "97 N2 Beta        High Flo" },{ 0x0879, "98 N2 Offset              " },
{ 0x0001, "99 N2 dAlpha/dT           " },{ 0x0002, "9a N2 dBeta/dT            " },{ 0x0003, "9b N2 dOffset/dT          " },
{ 0x4a89, "9c N2 Reference Temp      " },{ 0x0000, "9d N2 Septum Purge Flow   " },{ 0x0000, "9e N2 dPurgeFlow/dPres    " },
{ 0x0000, "9f N2 Max Inlet Flow      " },{ 0x0000, "a0 N2 Calib T1 oC * 100   " },{ 0x0000, "a1 N2 Calib T2 oC * 100   " },

{ 0x2ee6, "a2 O2 Alpha/2     Low Flow" },{ 0x2bf2, "a3 O2 Beta        Low Flow" },{ 0x0064, "a4 O2 High/Low Switch Flow" },
{ 0x3f40, "a5 O2 Alpha/2     High Flo" },{ 0x1e05, "a6 O2 Beta        High Flo" },{ 0x0879, "a7 O2 Offset              " },
{ 0x0001, "a8 O2 dAlpha/dT           " },{ 0x0002, "a9 O2 dBeta/dT            " },{ 0x0003, "aa O2 dOffset/dT          " },
{ 0x4a89, "ab O2 Reference Temp      " },{ 0x0000, "ac O2 Septum Purge Flow   " },{ 0x0000, "ad O2 dPurgeFlow/dPres    " },
{ 0x0000, "ae O2 Max Inlet Flow      " },{ 0x0000, "af O2 Calib T1 oC * 100   " },{ 0x0000, "b0 O2 Calib T2 oC * 100   " },

{ 0x4148, "b1  Air Alpha/2   Low Flow" },{ 0x1e8a, "b2  Air Beta      Low Flow" },{ 0xffff, "b3  Air High/Low Switch Fl" },
{ 0x0000, "b4  Air Alpha/2   High Flo" },{ 0x0000, "b5  Air Beta      High Flo" },{ 0x0879, "b6  Air Offset            " },
{ 0x0001, "b7  Air dAlpha/dT         " },{ 0x0002, "b8  Air dBeta/dT          " },{ 0x0003, "b9  Air dOffset/dT        " },
{ 0x4a89, "ba  Air Reference Temp    " },{ 0x0000, "bb  Air Septum Purge Flow " },{ 0x0000, "bc  Air dPurgeFlow/dPres  " },
{ 0x0000, "bd  Air Max Inlet Flow    " },{ 0x0000, "be  Air Calib T1 oC * 100 " },{ 0x0000, "bf  Air Calib T2 oC * 100 " },


   /* the words are used to allow an IQ manifold  (JIB) to be used as a secondary standard for inlet calibration  */
   /* -or- will be used to save the voltages from the tpzf commands for drift studies                             */
   /*  the first value in the label is the tpzf meaning, the second is the JIB (tprf/tpsf) meaning                */

{ 0x0000, "c0 H2 ref_flow * 100  sccm" },{ 0x0000, "c1 H2 V1                  " },{ 0x0000, "c2 H2 V2                  " },
{ 0x0000, "c3 H2 V3                  " },{ 0x0000, "c4 H2 V4                  " },{ 0x0000, "c5 H2 V5                  " },
{ 0x0000, "c6 H2 V6                  " },{ 0x0000, "c7 H2 V7                  " },{ 0x0000, "c8 H2 V8                  " },

{ 0x0000, "c9 He ref_flow * 100  sccm" },{ 0x0000, "ca He V1                  " },{ 0x0000, "cb He V2                  " },
{ 0x0000, "cc He V3                  " },{ 0x0000, "cd He V4                  " },{ 0x0000, "ce He V5                  " },
{ 0x0000, "cf He V6                  " },{ 0x0000, "d0 He V7                  " },{ 0x0000, "d1 He V8                  " },

{ 0x0000, "d2 ArMe ref_flow*100  sccm" },{ 0x0000, "d3 ArMe V1                " },{ 0x0000, "d4 ArMe V2                " },
{ 0x0000, "d5 ArMe V3                " },{ 0x0000, "d6 ArMe V4                " },{ 0x0000, "d7 ArMe V5                " },
{ 0x0000, "d8 ArMe V6                " },{ 0x0000, "d9 ArMe V7                " },{ 0x0000, "da ArMe V8                " },

{ 0x0000, "db N2 ref_flow * 100  sccm" },{ 0x0000, "dc N2 V1                  " },{ 0x0000, "dd N2 V2                  " },
{ 0x0000, "de N2 V3                  " },{ 0x0000, "df N2 V4                  " },{ 0x0000, "e0 N2 V5                  " },
{ 0x0000, "e1 N2 V6                  " },{ 0x0000, "e2 N2 V7                  " },{ 0x0000, "e3 N2 V8                  " },

{ 0x0000, "e4 O2 ref_flow * 100  sccm" },{ 0x0000, "e5 O2 V1                  " },{ 0x0000, "e6 O2 V2                  " },
{ 0x0000, "e7 O2 V3                  " },{ 0x0000, "e8 O2 V4                  " },{ 0x0000, "e9 O2 V5                  " },
{ 0x0000, "ea O2 V6                  " },{ 0x0000, "eb O2 V7                  " },{ 0x0000, "ec O2 V8                  " },

{ 0x0000, "ed  Air ref_flow*100  sccm" },{ 0x0000, "ee Air V1                 " },{ 0x0000, "ef Air V2                 " },
{ 0x0000, "f0 Air V3                 " },{ 0x0000, "f1 Air V4                 " },{ 0x0000, "f2 Air V5                 " },
{ 0x0000, "f3 Air V6                 " },{ 0x0000, "f4 Air V7                 " },{ 0x0000, "f5 Air V8                 " },

  /* used by a (JIB) as a secondary pressure standard   */

{ 0x0000, "f6 P1 Pres PSI * 100      " },{ 0x0000, "f7 P2 Pres PSI * 100      " },{ 0x0000, "f8 P3 Pres PSI * 100      " },
{ 0x0000, "f9 P4 Pres PSI * 100      " },{ 0x0000, "fa V P1 from DTPV         " },{ 0x0000, "fb V P2 from DTPV         " },
{ 0x0000, "fc V P3 from DTPV         " },{ 0x0000, "fd V P4 from DTPV         " },{ 0x0000, "fe                        " },


   /* unused */

{ 0x0000, "ff Test Station ID Number " }

/*#!inc_addr*/




 };



static const U_INT16 Factory_Inlet_Pid_Address_Table[2][8/*gas*/][4/*term*/][3/*ch*/]= {

{ /* normal inlet mapping */
{{ FACT_CH_1_N2_I_GAIN,         FACT_CH_2_N2_I_GAIN,    FACT_CH_3_N2_I_GAIN     },
 { FACT_CH_1_N2_P_GAIN,         FACT_CH_2_N2_P_GAIN,    FACT_CH_3_N2_P_GAIN     },
 { FACT_CH_1_N2_D_GAIN,         FACT_CH_2_N2_D_GAIN,    FACT_CH_3_N2_D_GAIN     },
 { FACT_CH_1_N2_NL_GAIN,        FACT_CH_2_N2_NL_GAIN,   FACT_CH_3_N2_NL_GAIN    }},

{{ FACT_CH_1_H2_I_GAIN,         FACT_CH_2_H2_I_GAIN,    FACT_CH_3_H2_I_GAIN     },
 { FACT_CH_1_H2_P_GAIN,         FACT_CH_2_H2_P_GAIN,    FACT_CH_3_H2_P_GAIN     },
 { FACT_CH_1_H2_D_GAIN,         FACT_CH_2_H2_D_GAIN,    FACT_CH_3_H2_D_GAIN     },
 { FACT_CH_1_H2_NL_GAIN,        FACT_CH_2_H2_NL_GAIN,   FACT_CH_3_H2_NL_GAIN    }},

{{ FACT_CH_1_He_I_GAIN,         FACT_CH_2_He_I_GAIN,    FACT_CH_3_He_I_GAIN     },
 { FACT_CH_1_He_P_GAIN,         FACT_CH_2_He_P_GAIN,    FACT_CH_3_He_P_GAIN     },
 { FACT_CH_1_He_D_GAIN,         FACT_CH_2_He_D_GAIN,    FACT_CH_3_He_D_GAIN     },
 { FACT_CH_1_He_NL_GAIN,        FACT_CH_2_He_NL_GAIN,   FACT_CH_3_He_NL_GAIN    }},

{{ FACT_CH_1_ArMe_I_GAIN,       FACT_CH_2_ArMe_I_GAIN,  FACT_CH_3_ArMe_I_GAIN   },
 { FACT_CH_1_ArMe_P_GAIN,       FACT_CH_2_ArMe_P_GAIN,  FACT_CH_3_ArMe_P_GAIN   },
 { FACT_CH_1_ArMe_D_GAIN,       FACT_CH_2_ArMe_D_GAIN,  FACT_CH_3_ArMe_D_GAIN   },
 { FACT_CH_1_ArMe_NL_GAIN,      FACT_CH_2_ArMe_NL_GAIN, FACT_CH_3_ArMe_NL_GAIN  }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }} },

{ /* special mapping for Jill */
{{ JILL_CH_1_N2_I_GAIN,         JILL_CH_2_N2_I_GAIN,    JILL_CH_3_N2_I_GAIN     },
 { JILL_CH_1_N2_P_GAIN,         JILL_CH_2_N2_P_GAIN,    JILL_CH_3_N2_P_GAIN     },
 { JILL_CH_1_N2_D_GAIN,         JILL_CH_2_N2_D_GAIN,    JILL_CH_3_N2_D_GAIN     },
 { JILL_CH_1_N2_NL_GAIN,        JILL_CH_2_N2_NL_GAIN,   JILL_CH_3_N2_NL_GAIN    }},

{{ JILL_CH_1_H2_I_GAIN,         JILL_CH_2_H2_I_GAIN,    JILL_CH_3_H2_I_GAIN     },
 { JILL_CH_1_H2_P_GAIN,         JILL_CH_2_H2_P_GAIN,    JILL_CH_3_H2_P_GAIN     },
 { JILL_CH_1_H2_D_GAIN,         JILL_CH_2_H2_D_GAIN,    JILL_CH_3_H2_D_GAIN     },
 { JILL_CH_1_H2_NL_GAIN,        JILL_CH_2_H2_NL_GAIN,   JILL_CH_3_H2_NL_GAIN    }},

{{ JILL_CH_1_He_I_GAIN,         JILL_CH_2_He_I_GAIN,    JILL_CH_3_He_I_GAIN     },
 { JILL_CH_1_He_P_GAIN,         JILL_CH_2_He_P_GAIN,    JILL_CH_3_He_P_GAIN     },
 { JILL_CH_1_He_D_GAIN,         JILL_CH_2_He_D_GAIN,    JILL_CH_3_He_D_GAIN     },
 { JILL_CH_1_He_NL_GAIN,        JILL_CH_2_He_NL_GAIN,   JILL_CH_3_He_NL_GAIN    }},

{{ JILL_CH_1_ArMe_I_GAIN,       JILL_CH_2_ArMe_I_GAIN,  JILL_CH_3_ArMe_I_GAIN   },
 { JILL_CH_1_ArMe_P_GAIN,       JILL_CH_2_ArMe_P_GAIN,  JILL_CH_3_ArMe_P_GAIN   },
 { JILL_CH_1_ArMe_D_GAIN,       JILL_CH_2_ArMe_D_GAIN,  JILL_CH_3_ArMe_D_GAIN   },
 { JILL_CH_1_ArMe_NL_GAIN,      JILL_CH_2_ArMe_NL_GAIN, JILL_CH_3_ArMe_NL_GAIN  }},

{{ JILL_CH_1_O2_I_GAIN,         JILL_CH_2_O2_I_GAIN,    JILL_CH_3_O2_I_GAIN,    },
 { JILL_CH_1_O2_P_GAIN,         JILL_CH_2_O2_P_GAIN,    JILL_CH_3_O2_P_GAIN,    },
 { JILL_CH_1_O2_D_GAIN,         JILL_CH_2_O2_D_GAIN,    JILL_CH_3_O2_D_GAIN,    },
 { JILL_CH_1_O2_NL_GAIN,        JILL_CH_2_O2_NL_GAIN,   JILL_CH_3_O2_NL_GAIN,   }},

{{ JILL_CH_1_Air_I_GAIN,        JILL_CH_2_Air_I_GAIN,   JILL_CH_3_Air_I_GAIN,   },
 { JILL_CH_1_Air_P_GAIN,        JILL_CH_2_Air_P_GAIN,   JILL_CH_3_Air_P_GAIN,   },
 { JILL_CH_1_Air_D_GAIN,        JILL_CH_2_Air_D_GAIN,   JILL_CH_3_Air_D_GAIN,   },
 { JILL_CH_1_Air_NL_GAIN,       JILL_CH_2_Air_NL_GAIN,  JILL_CH_3_Air_NL_GAIN,  }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }}
 }};





static const U_INT16 User_Inlet_Pid_Address_Table[/*gas*/][4/*term*/][3/*ch*/]= {

{{ USER_CH_1_N2_I_GAIN,         USER_CH_2_N2_I_GAIN,    USER_CH_3_N2_I_GAIN     },
 { USER_CH_1_N2_P_GAIN,         USER_CH_2_N2_P_GAIN,    USER_CH_3_N2_P_GAIN     },
 { USER_CH_1_N2_D_GAIN,         USER_CH_2_N2_D_GAIN,    USER_CH_3_N2_D_GAIN     },
 { USER_CH_1_N2_NL_GAIN,        USER_CH_2_N2_NL_GAIN,   USER_CH_3_N2_NL_GAIN    }},

{{ USER_CH_1_H2_I_GAIN,         USER_CH_2_H2_I_GAIN,    USER_CH_3_H2_I_GAIN     },
 { USER_CH_1_H2_P_GAIN,         USER_CH_2_H2_P_GAIN,    USER_CH_3_H2_P_GAIN     },
 { USER_CH_1_H2_D_GAIN,         USER_CH_2_H2_D_GAIN,    USER_CH_3_H2_D_GAIN     },
 { USER_CH_1_H2_NL_GAIN,        USER_CH_2_H2_NL_GAIN,   USER_CH_3_H2_NL_GAIN    }},

{{ USER_CH_1_He_I_GAIN,         USER_CH_2_He_I_GAIN,    USER_CH_3_He_I_GAIN     },
 { USER_CH_1_He_P_GAIN,         USER_CH_2_He_P_GAIN,    USER_CH_3_He_P_GAIN     },
 { USER_CH_1_He_D_GAIN,         USER_CH_2_He_D_GAIN,    USER_CH_3_He_D_GAIN     },
 { USER_CH_1_He_NL_GAIN,        USER_CH_2_He_NL_GAIN,   USER_CH_3_He_NL_GAIN    }},

{{ USER_CH_1_ArMe_I_GAIN,       USER_CH_2_ArMe_I_GAIN,  USER_CH_3_ArMe_I_GAIN   },
 { USER_CH_1_ArMe_P_GAIN,       USER_CH_2_ArMe_P_GAIN,  USER_CH_3_ArMe_P_GAIN   },
 { USER_CH_1_ArMe_D_GAIN,       USER_CH_2_ArMe_D_GAIN,  USER_CH_3_ArMe_D_GAIN   },
 { USER_CH_1_ArMe_NL_GAIN,      USER_CH_2_ArMe_NL_GAIN, USER_CH_3_ArMe_NL_GAIN  }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }},

{{              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               },
 {              0,                      0,                      0               }}
 };


/**begin_proto**/

U_INT16 GetFactInletPidEepromAddress( U_INT16 type, GAS_TYPE gas, U_INT8 sensor_position, U_INT8 term )

/**end_proto**/
{
    return Factory_Inlet_Pid_Address_Table [ (U_INT8) ( type == (((U_INT16)INLET_MODULE<<8)|(U_INT16)JIB)) ]
                                           [ (U_INT8)gas ]
                                           [ term ]
                                           [ sensor_position -1 ];
}

/**begin_proto**/

U_INT16 GetUserInletPidEepromAddress( GAS_TYPE gas, U_INT8 sensor_position, U_INT8 term )

/**end_proto**/
{
    return User_Inlet_Pid_Address_Table [ (U_INT8)gas ] [ term ] [ sensor_position -1 ];
}



static const Flow_Sensor_Address_Table [2] [8] [13] = {
{ /* Normal inlet mapping */

{ N2_ALPHA_LOW,         N2_BETA_LOW,            N2_HIGH_FLOW,
  N2_ALPHA_HIGH,        N2_BETA_HIGH,           N2_OFFSET,
  N2_dALPHA_dT,         N2_dBETA_dT,            N2_dOFFSET_dT,
  N2_REF_TEMP,          N2_PURGE_FLOW,          N2_dPURGE_dP,
  N2_MAX_INLET_FLOW                                             },

{ H2_ALPHA_LOW,         H2_BETA_LOW,            H2_HIGH_FLOW,
  H2_ALPHA_HIGH,        H2_BETA_HIGH,           H2_OFFSET,
  H2_dALPHA_dT,         H2_dBETA_dT,            H2_dOFFSET_dT,
  H2_REF_TEMP,          H2_PURGE_FLOW,          H2_dPURGE_dP,
  H2_MAX_INLET_FLOW                                             },

{ He_ALPHA_LOW,         He_BETA_LOW,            He_HIGH_FLOW,
  He_ALPHA_HIGH,        He_BETA_HIGH,           He_OFFSET,
  He_dALPHA_dT,         He_dBETA_dT,            He_dOFFSET_dT,
  He_REF_TEMP,          He_PURGE_FLOW,          He_dPURGE_dP,
  He_MAX_INLET_FLOW                                             },

{ ArMe_ALPHA_LOW,       ArMe_BETA_LOW,          ArMe_HIGH_FLOW,
  ArMe_ALPHA_HIGH,      ArMe_BETA_HIGH,         ArMe_OFFSET,
  ArMe_dALPHA_dT,       ArMe_dBETA_dT,          ArMe_dOFFSET_dT,
  ArMe_REF_TEMP,        ArMe_PURGE_FLOW,        ArMe_dPURGE_dP,
  ArMe_MAX_INLET_FLOW                                           },

{       0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0                                                       },

{       0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0                                                       },

{       0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0                                                       },

{       0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0                                                       } },

{ /* special mapping for Jill */

{ JILL_N2_ALPHA_LOW,    JILL_N2_BETA_LOW,       JILL_N2_HIGH_FLOW,
  JILL_N2_ALPHA_HIGH,   JILL_N2_BETA_HIGH,      JILL_N2_OFFSET,
  JILL_N2_dALPHA_dT,    JILL_N2_dBETA_dT,       JILL_N2_dOFFSET_dT,
  JILL_N2_REF_TEMP,     JILL_N2_PURGE_FLOW,     JILL_N2_dPURGE_dP,
  JILL_N2_MAX_INLET_FLOW                                        },

{ JILL_H2_ALPHA_LOW,    JILL_H2_BETA_LOW,       JILL_H2_HIGH_FLOW,
  JILL_H2_ALPHA_HIGH,   JILL_H2_BETA_HIGH,      JILL_H2_OFFSET,
  JILL_H2_dALPHA_dT,    JILL_H2_dBETA_dT,       JILL_H2_dOFFSET_dT,
  JILL_H2_REF_TEMP,     JILL_H2_PURGE_FLOW,     JILL_H2_dPURGE_dP,
  JILL_H2_MAX_INLET_FLOW                                        },

{ JILL_He_ALPHA_LOW,    JILL_He_BETA_LOW,       JILL_He_HIGH_FLOW,
  JILL_He_ALPHA_HIGH,   JILL_He_BETA_HIGH,      JILL_He_OFFSET,
  JILL_He_dALPHA_dT,    JILL_He_dBETA_dT,       JILL_He_dOFFSET_dT,
  JILL_He_REF_TEMP,     JILL_He_PURGE_FLOW,     JILL_He_dPURGE_dP,
  JILL_He_MAX_INLET_FLOW                                        },

{ JILL_ArMe_ALPHA_LOW,  JILL_ArMe_BETA_LOW,     JILL_ArMe_HIGH_FLOW,
  JILL_ArMe_ALPHA_HIGH, JILL_ArMe_BETA_HIGH,    JILL_ArMe_OFFSET,
  JILL_ArMe_dALPHA_dT,  JILL_ArMe_dBETA_dT,     JILL_ArMe_dOFFSET_dT,
  JILL_ArMe_REF_TEMP,   JILL_ArMe_PURGE_FLOW,   JILL_ArMe_dPURGE_dP,
  JILL_ArMe_MAX_INLET_FLOW                                      },

{ JILL_O2_ALPHA_LOW,    JILL_O2_BETA_LOW,       JILL_O2_HIGH_FLOW,
  JILL_O2_ALPHA_HIGH,   JILL_O2_BETA_HIGH,      JILL_O2_OFFSET,
  JILL_O2_dALPHA_dT,    JILL_O2_dBETA_dT,       JILL_O2_dOFFSET_dT,
  JILL_O2_REF_TEMP,     JILL_O2_PURGE_FLOW,     JILL_O2_dPURGE_dP,
  JILL_O2_MAX_INLET_FLOW                                        },

{ JILL_Air_ALPHA_LOW,   JILL_Air_BETA_LOW,      JILL_Air_HIGH_FLOW,
  JILL_Air_ALPHA_HIGH,  JILL_Air_BETA_HIGH,     JILL_Air_OFFSET,
  JILL_Air_dALPHA_dT,   JILL_Air_dBETA_dT,      JILL_Air_dOFFSET_dT,
  JILL_Air_REF_TEMP,    JILL_Air_PURGE_FLOW,    JILL_Air_dPURGE_dP,
  JILL_Air_MAX_INLET_FLOW                                       },

{       0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0                                                       },

{       0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0,                      0,                      0,
        0                                                       } } };




static const Normal_Inlet_Calib_Address_Table [ 4 ] [ 11 ] = {


 { N2_CALIB_REF_FLOW,    N2_CALIB_V0_T1,    N2_CALIB_V1_T1,
   N2_CALIB_V3_T1,       N2_CALIB_V9_T1,    N2_CALIB_V0_T2,
   N2_CALIB_V1_T2,       N2_CALIB_V3_T2,    N2_CALIB_V9_T2,
   N2_CALIB_T1,          N2_CALIB_T2                         },

 { H2_CALIB_REF_FLOW,    H2_CALIB_V0_T1,    H2_CALIB_V1_T1,
   H2_CALIB_V3_T1,       H2_CALIB_V9_T1,    H2_CALIB_V0_T2,
   H2_CALIB_V1_T2,       H2_CALIB_V3_T2,    H2_CALIB_V9_T2,
   H2_CALIB_T1,          H2_CALIB_T2                         },

 { He_CALIB_REF_FLOW,    He_CALIB_V0_T1,    He_CALIB_V1_T1,
   He_CALIB_V3_T1,       He_CALIB_V9_T1,    He_CALIB_V0_T2,
   He_CALIB_V1_T2,       He_CALIB_V3_T2,    He_CALIB_V9_T2,
   He_CALIB_T1,          He_CALIB_T2                         },

 { ArMe_CALIB_REF_FLOW,  ArMe_CALIB_V0_T1,  ArMe_CALIB_V1_T1,
   ArMe_CALIB_V3_T1,     ArMe_CALIB_V9_T1,  ArMe_CALIB_V0_T2,
   ArMe_CALIB_V1_T2,     ArMe_CALIB_V3_T2,  ArMe_CALIB_V9_T2,
   ArMe_CALIB_T1,        ArMe_CALIB_T2                       } };



 
static const Jill_Calib_Address_Table [ ] [ 9 ] = {

 { JILL_N2_CALIB_REF_FLOW,   JILL_N2_CALIB_V1,   JILL_N2_CALIB_V2,
   JILL_N2_CALIB_V3,         JILL_N2_CALIB_V4,   JILL_N2_CALIB_V5,
   JILL_N2_CALIB_V6,         JILL_N2_CALIB_V7,   JILL_N2_CALIB_V8   },

 { JILL_H2_CALIB_REF_FLOW,   JILL_H2_CALIB_V1,   JILL_H2_CALIB_V2,
   JILL_H2_CALIB_V3,         JILL_H2_CALIB_V4,   JILL_H2_CALIB_V5,
   JILL_H2_CALIB_V6,         JILL_H2_CALIB_V7,   JILL_H2_CALIB_V8   },

 { JILL_He_CALIB_REF_FLOW,   JILL_He_CALIB_V1,   JILL_He_CALIB_V2,
   JILL_He_CALIB_V3,         JILL_He_CALIB_V4,   JILL_He_CALIB_V5,
   JILL_He_CALIB_V6,         JILL_He_CALIB_V7,   JILL_He_CALIB_V8   },

 { JILL_ArMe_CALIB_REF_FLOW, JILL_ArMe_CALIB_V1, JILL_ArMe_CALIB_V2,
   JILL_ArMe_CALIB_V3,       JILL_ArMe_CALIB_V4, JILL_ArMe_CALIB_V5,
   JILL_ArMe_CALIB_V6,       JILL_ArMe_CALIB_V7, JILL_ArMe_CALIB_V8 },

 { JILL_O2_CALIB_REF_FLOW,   JILL_O2_CALIB_V1,   JILL_O2_CALIB_V2,
   JILL_O2_CALIB_V3,         JILL_O2_CALIB_V4,   JILL_O2_CALIB_V5,
   JILL_O2_CALIB_V6,         JILL_O2_CALIB_V7,   JILL_O2_CALIB_V8   },

 { JILL_Air_CALIB_REF_FLOW,  JILL_Air_CALIB_V1,  JILL_Air_CALIB_V2,
   JILL_Air_CALIB_V3,        JILL_Air_CALIB_V4,  JILL_Air_CALIB_V5,
   JILL_Air_CALIB_V6,        JILL_Air_CALIB_V7,  JILL_Air_CALIB_V8  } };



/**begin_proto**/

U_INT16 GetFSensorParmAddress( INLET_TYPE type, GAS_TYPE gas, U_INT8 parm_num )

/**end_proto**/
{

   return Flow_Sensor_Address_Table [ (U_INT8)(type == JIB) ] [ (U_INT8) gas ] [ parm_num ];

}


/**begin_proto**/

U_INT16 GetInletParmAddress( GAS_TYPE gas, U_INT8 parm_num )

/**end_proto**/
{

   return Normal_Inlet_Calib_Address_Table [ (U_INT8) gas ] [ parm_num ];

}


/**begin_proto**/

U_INT16 GetJillParmAddress( GAS_TYPE gas, U_INT8 parm_num )

/**end_proto**/
{

   return Jill_Calib_Address_Table [ (U_INT8) gas ] [ parm_num ];

}



static const UPDATE_TABLE_ENTRY  INIT_PP_PID_TABLE[] = {

 { INIT_PID,  0x0345, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_PID,  0x02d4, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_PID,  0x01dd, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x0016, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0004, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0005, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_PID,  0x03ff, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_PID,  0x0352, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_PID,  0x0193, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0042, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0007, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0006, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_PID,  0x0319, FACT_CH_1_He_I_GAIN,      1},
 { INIT_PID,  0x02bb, FACT_CH_1_He_P_GAIN,      1},
 { INIT_PID,  0x017b, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0051, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x000a, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0009, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_He_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_He_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_PID,  0x0345, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_PID,  0x02d4, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_PID,  0x01dd, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD, 0xffff, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0016, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0004, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0005, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_PID,  0x0000, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_PID,  0x0000, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_PID,  0x0000, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD, 0x0000, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };



static const UPDATE_TABLE_ENTRY  INIT_ACI_PID_TABLE[] = {

 { INIT_PID,  0x0345, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_PID,  0x02d4, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_PID,  0x01dd, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x0016, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0004, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0005, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_PID,  0x03ff, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_PID,  0x0352, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_PID,  0x0193, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0042, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0007, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0006, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_PID,  0x0319, FACT_CH_1_He_I_GAIN,      1},
 { INIT_PID,  0x02bb, FACT_CH_1_He_P_GAIN,      1},
 { INIT_PID,  0x017b, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0051, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x000a, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0009, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_He_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_He_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_PID,  0x0345, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_PID,  0x02d4, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_PID,  0x01dd, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD, 0xffff, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0016, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0004, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0005, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_PID,  0x0000, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_PID,  0x0000, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_PID,  0x0000, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD, 0x0000, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };


static const UPDATE_TABLE_ENTRY  INIT_COC_PID_TABLE[] = {

 { INIT_PID,  0x0376, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_PID,  0x01d6, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_PID,  0x01ee, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x0000, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_PID,  0x0378, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_PID,  0x0186, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_PID,  0x0158, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0000, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_PID,  0x0238, FACT_CH_1_He_I_GAIN,      1},
 { INIT_PID,  0x014c, FACT_CH_1_He_P_GAIN,      1},
 { INIT_PID,  0x0185, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD, 0xffff, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0000, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0x0000, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_PID,  0x0000, FACT_CH_3_He_I_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_He_P_GAIN,      1},
 { INIT_PID,  0x0000, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD, 0x0000, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_PID,  0x0376, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_PID,  0x01d6, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_PID,  0x01ee, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD, 0xffff, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0x0000, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_PID,  0x0000, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_PID,  0x0000, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_PID,  0x0000, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD, 0x0000, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };


static const UPDATE_TABLE_ENTRY  INIT_SS100_PID_TABLE[] = {

 { INIT_WORD, 0x02d2, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_WORD, 0x0784, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_WORD, 0x1fa1, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD,  16384, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x00a2, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD,   1087, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0650, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_WORD, 0x10d9, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_WORD, 0xb3a2, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD,   3450, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_WORD, 0x0510, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_WORD, 0x063b, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_WORD, 0x18ed, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD,  22795, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0111, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0017, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD,    764, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0467, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_WORD, 0x06b6, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_WORD, 0x28dd, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD,   2142, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0256, FACT_CH_1_He_I_GAIN,      1},
 { INIT_WORD, 0x06ad, FACT_CH_1_He_P_GAIN,      1},
 { INIT_WORD, 0x1ef5, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD,  20695, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0173, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x002e, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD,   1007, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x01ed, FACT_CH_3_He_I_GAIN,      1},
 { INIT_WORD, 0x0527, FACT_CH_3_He_P_GAIN,      1},
 { INIT_WORD, 0x36e2, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD,   1233, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_WORD, 0x0485, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_WORD, 0x09fe, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_WORD, 0x3f4e, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD,  16384, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x00a2, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x001d, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0023, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD,   1087, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0ca1, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_WORD, 0x10d9, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_WORD, 0xb3a2, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD,   3450, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };



static const UPDATE_TABLE_ENTRY  INIT_SS150_PID_TABLE[] = {

 { INIT_WORD, 0x0392, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_WORD, 0x097c, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_WORD, 0x1ae8, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD,  16384, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x006b, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0013, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0017, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD,   1087, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0905, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_WORD, 0x1812, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_WORD, 0xb3a2, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD,   3450, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_WORD, 0x060e, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_WORD, 0x0772, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_WORD, 0x11ca, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD,  22795, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x00ae, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x000e, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0007, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD,    968, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0625, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_WORD, 0x0960, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_WORD, 0x28dd, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD,   1688, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0381, FACT_CH_1_He_I_GAIN,      1},
 { INIT_WORD, 0x0a04, FACT_CH_1_He_P_GAIN,      1},
 { INIT_WORD, 0x1e02, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD,  20695, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x00fd, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x000e, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD,   1007, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x02eb, FACT_CH_3_He_I_GAIN,      1},
 { INIT_WORD, 0x07ca, FACT_CH_3_He_P_GAIN,      1},
 { INIT_WORD, 0x36e2, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD,   1233, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_WORD, 0x0392, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_WORD, 0x097c, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_WORD, 0x1ea8, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD,  16384, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x006b, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0013, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0017, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD,   1087, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0905, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_WORD, 0x1812, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_WORD, 0xb3a2, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD,   3450, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };


static const UPDATE_TABLE_ENTRY  INIT_SS15_PID_TABLE[] = {

 { INIT_WORD, 0x02d2*15/100, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_WORD, 0x0784*15/100, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_WORD, 0x1fa1*15/100, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD,  16384*15/100, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x00a2, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD,   1087, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0650*15/100, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_WORD, 0x10d9*15/100, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_WORD, 0xb3a2*15/100, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD,   3450*15/100, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_WORD, 0x0510*15/100, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_WORD, 0x063b*15/100, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_WORD, 0x18ed*15/100, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD,  22795*15/100, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0111, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0017, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD,    764, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0467*15/100, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_WORD, 0x06b6*15/100, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_WORD, 0x28dd*15/100, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD,   2142*15/100, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0256*15/100, FACT_CH_1_He_I_GAIN,      1},
 { INIT_WORD, 0x06ad*15/100, FACT_CH_1_He_P_GAIN,      1},
 { INIT_WORD, 0x1ef5*15/100, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD,  20695*15/100, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0173, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x002e, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD,   1007, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x01ed*15/100, FACT_CH_3_He_I_GAIN,      1},
 { INIT_WORD, 0x0527*15/100, FACT_CH_3_He_P_GAIN,      1},
 { INIT_WORD, 0x36e2*15/100, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD,   1233*15/100, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_WORD, 0x0485*15/100, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_WORD, 0x09fe*15/100, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_WORD, 0x3f4e*15/100, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD,  16384*15/100, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x00a2, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x001d, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0023, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD,   1087, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0ca1*15/100, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_WORD, 0x10d9*15/100, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_WORD, 0xb3a2*15/100, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD,   3450*15/100, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };






static const UPDATE_TABLE_ENTRY  INIT_PTV_PID_TABLE[] = {

 { INIT_PID,  0x02d2, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_PID,  0x0784, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_PID,  0x1fa1, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD,  16384, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x00a2, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD,   1087, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_PID,  0x0650, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_PID,  0x10d9, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_PID,  0xb3a2, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD,   3450, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_PID,  0x0510, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_PID,  0x063b, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_PID,  0x18ed, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD,  22795, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0111, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0017, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD,    764, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_PID,  0x0467, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_PID,  0x06b6, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_PID,  0x28dd, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD,   2142, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_PID,  0x0256, FACT_CH_1_He_I_GAIN,      1},
 { INIT_PID,  0x06ad, FACT_CH_1_He_P_GAIN,      1},
 { INIT_PID,  0x1ef5, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD,  20695, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0173, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x002e, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD,   1007, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_PID,  0x01ed, FACT_CH_3_He_I_GAIN,      1},
 { INIT_PID,  0x0527, FACT_CH_3_He_P_GAIN,      1},
 { INIT_PID,  0x36e2, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD,   1233, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_PID,  0x0485, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_PID,  0x09fe, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_PID,  0x3f4e, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD,  16384, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x00a2, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x001d, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0023, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD,   1087, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_PID,  0x0ca1, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_PID,  0x10d9, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_PID,  0xb3a2, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD,   3450, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };


static const UPDATE_TABLE_ENTRY  INIT_G_PTV_PID_TABLE[] = {

 { INIT_PID,  0x02d2, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_PID,  0x0784, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_PID,  0x1fa1, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD,  16384, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x00a2, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD,   1087, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_PID,  0x0650, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_PID,  0x10d9, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_PID,  0xb3a2, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD,   3450, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_PID,  0x0510, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_PID,  0x063b, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_PID,  0x18ed, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD,  22795, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0111, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0017, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD,    764, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_PID,  0x0467, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_PID,  0x06b6, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_PID,  0x28dd, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD,   2142, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_PID,  0x0256, FACT_CH_1_He_I_GAIN,      1},
 { INIT_PID,  0x06ad, FACT_CH_1_He_P_GAIN,      1},
 { INIT_PID,  0x1ef5, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD,  20695, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0173, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x002e, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD,   1007, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_PID,  0x01ed, FACT_CH_3_He_I_GAIN,      1},
 { INIT_PID,  0x0527, FACT_CH_3_He_P_GAIN,      1},
 { INIT_PID,  0x36e2, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD,   1233, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_PID,  0x0485, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_PID,  0x09fe, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_PID,  0x3f4e, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD,  16384, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x00a2, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x001d, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0023, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD,   1087, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_PID,  0x0ca1, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_PID,  0x10d9, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_PID,  0xb3a2, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD,   3450, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };



static const UPDATE_TABLE_ENTRY  INIT_CIS3_PID_TABLE[] = {

 { INIT_PID,  0x02d2, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_PID,  0x0784, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_PID,  0x1fa1, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD,  16384, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x00a2, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD,   1087, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_PID,  0x0650, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_PID,  0x10d9, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_PID,  0xb3a2, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD,   3450, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_PID,  0x0510, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_PID,  0x063b, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_PID,  0x18ed, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD,  22795, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0111, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0017, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD,    764, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_PID,  0x0467, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_PID,  0x06b6, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_PID,  0x28dd, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD,   2142, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_PID,  0x0256, FACT_CH_1_He_I_GAIN,      1},
 { INIT_PID,  0x06ad, FACT_CH_1_He_P_GAIN,      1},
 { INIT_PID,  0x1ef5, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD,  20695, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0173, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x002e, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD,   1007, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_PID,  0x01ed, FACT_CH_3_He_I_GAIN,      1},
 { INIT_PID,  0x0527, FACT_CH_3_He_P_GAIN,      1},
 { INIT_PID,  0x36e2, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD,   1233, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_PID,  0x0485, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_PID,  0x09fe, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_PID,  0x3f4e, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD,  16384, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x00a2, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x001d, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0023, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD,   1087, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_PID,  0x0ca1, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_PID,  0x10d9, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_PID,  0xb3a2, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD,   3450, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };



static const UPDATE_TABLE_ENTRY  INIT_CIS4_PID_TABLE[] = {

 { INIT_PID,  0x02d2, FACT_CH_1_N2_I_GAIN,      1},
 { INIT_PID,  0x0784, FACT_CH_1_N2_P_GAIN,      1},
 { INIT_PID,  0x1fa1, FACT_CH_1_N2_D_GAIN,      1},
 { INIT_WORD,  16384, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x00a2, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD,   1087, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_PID,  0x0650, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_PID,  0x10d9, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_PID,  0xb3a2, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD,   3450, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_PID,  0x0510, FACT_CH_1_H2_I_GAIN,      1},
 { INIT_PID,  0x063b, FACT_CH_1_H2_P_GAIN,      1},
 { INIT_PID,  0x18ed, FACT_CH_1_H2_D_GAIN,      1},
 { INIT_WORD,  22795, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0111, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0017, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD,    764, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_PID,  0x0467, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_PID,  0x06b6, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_PID,  0x28dd, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD,   2142, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_PID,  0x0256, FACT_CH_1_He_I_GAIN,      1},
 { INIT_PID,  0x06ad, FACT_CH_1_He_P_GAIN,      1},
 { INIT_PID,  0x1ef5, FACT_CH_1_He_D_GAIN,      1},
 { INIT_WORD,  20695, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0173, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x002e, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD,   1007, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_PID,  0x01ed, FACT_CH_3_He_I_GAIN,      1},
 { INIT_PID,  0x0527, FACT_CH_3_He_P_GAIN,      1},
 { INIT_PID,  0x36e2, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD,   1233, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_PID,  0x0485, FACT_CH_1_ArMe_I_GAIN,    1},
 { INIT_PID,  0x09fe, FACT_CH_1_ArMe_P_GAIN,    1},
 { INIT_PID,  0x3f4e, FACT_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD,  16384, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x00a2, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x001d, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0023, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD,   1087, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_PID,  0x0ca1, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_PID,  0x10d9, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_PID,  0xb3a2, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD,   3450, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };

static const UPDATE_TABLE_ENTRY  INIT_VI_PID_TABLE[] = {  /* same as SS100 tbl EXCEPT for CH1 */

 { INIT_WORD, 0x04ba, FACT_CH_1_N2_I_GAIN,      1}, /* Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD, 0x1900, FACT_CH_1_N2_P_GAIN,      1}, /* Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD, 0xf000, FACT_CH_1_N2_D_GAIN,      1}, /* Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD,  16384, FACT_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x00a2, FACT_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_N2_D_GAIN,      0},
 { INIT_WORD,   1087, FACT_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0650, FACT_CH_3_N2_I_GAIN,      1},
 { INIT_WORD, 0x10d9, FACT_CH_3_N2_P_GAIN,      1},
 { INIT_WORD, 0xb3a2, FACT_CH_3_N2_D_GAIN,      1},
 { INIT_WORD,   3450, FACT_CH_3_N2_NL_GAIN,     1},

 { INIT_WORD, 0x0011, FACT_CH_1_H2_I_GAIN,      1}, /* + Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD, 0x0357, FACT_CH_1_H2_P_GAIN,      1}, /* + Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD, 0x0000, FACT_CH_1_H2_D_GAIN,      1}, /* + Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD,  22795, FACT_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0111, FACT_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x001d, FACT_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0017, FACT_CH_2_H2_D_GAIN,      0},
 { INIT_WORD,    764, FACT_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0467, FACT_CH_3_H2_I_GAIN,      1},
 { INIT_WORD, 0x06b6, FACT_CH_3_H2_P_GAIN,      1},
 { INIT_WORD, 0x28dd, FACT_CH_3_H2_D_GAIN,      1},
 { INIT_WORD,   2142, FACT_CH_3_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0011, FACT_CH_1_He_I_GAIN,      1}, /* Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD, 0x0357, FACT_CH_1_He_P_GAIN,      1}, /* Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD, 0x0000, FACT_CH_1_He_D_GAIN,      1}, /* Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD,  20695, FACT_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0173, FACT_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x002e, FACT_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0023, FACT_CH_2_He_D_GAIN,      0},
 { INIT_WORD,   1007, FACT_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x01ed, FACT_CH_3_He_I_GAIN,      1},
 { INIT_WORD, 0x0527, FACT_CH_3_He_P_GAIN,      1},
 { INIT_WORD, 0x36e2, FACT_CH_3_He_D_GAIN,      1},
 { INIT_WORD,   1233, FACT_CH_3_He_NL_GAIN,     1},

 { INIT_WORD, 0x05c6, FACT_CH_1_ArMe_I_GAIN,    1}, /* + Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD, 0x2200, FACT_CH_1_ArMe_P_GAIN,    1}, /* + Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD, 0xf000, FACT_CH_1_ArMe_D_GAIN,    1}, /* + Warning: may be unstable if used with std S/SL plumbing */
 { INIT_WORD,  16384, FACT_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x00a2, FACT_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x001d, FACT_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0023, FACT_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD,   1087, FACT_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0ca1, FACT_CH_3_ArMe_I_GAIN,    1},
 { INIT_WORD, 0x10d9, FACT_CH_3_ArMe_P_GAIN,    1},
 { INIT_WORD, 0xb3a2, FACT_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD,   3450, FACT_CH_3_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x0000, USER_CH_1_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_N2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_N2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_H2_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_H2_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_1_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_1_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_2_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_3_He_I_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_P_GAIN,      0},
 { INIT_WORD, 0x0000, USER_CH_3_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, USER_CH_3_He_NL_GAIN,     0},

 { INIT_WORD, 0x0000, USER_CH_1_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_1_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_1_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_2_ArMe_NL_GAIN,   0},

 { INIT_WORD, 0x0000, USER_CH_3_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0000, USER_CH_3_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, USER_CH_3_ArMe_NL_GAIN,   0},

 { END,         0,      0,      0}  };


static const UPDATE_TABLE_ENTRY  INIT_JILL_PID_TABLE[] = {

 { INIT_PID,  0x0376, JILL_CH_1_N2_I_GAIN,      1},
 { INIT_PID,  0x01d6, JILL_CH_1_N2_P_GAIN,      1},
 { INIT_PID,  0x01ee, JILL_CH_1_N2_D_GAIN,      1},
 { INIT_WORD, 0xffff, JILL_CH_1_N2_NL_GAIN,     1},

 { INIT_WORD, 0x000b, JILL_CH_2_N2_I_GAIN,      0},
 { INIT_WORD, 0x0002, JILL_CH_2_N2_P_GAIN,      0},
 { INIT_WORD, 0x0003, JILL_CH_2_N2_D_GAIN,      0},
 { INIT_WORD, 0xffff, JILL_CH_2_N2_NL_GAIN,     0},

 { INIT_PID,  0x0ca1, JILL_CH_3_N2_I_GAIN,      1},
 { INIT_PID,  0x10d9, JILL_CH_3_N2_P_GAIN,      1},
 { INIT_PID,  0xb3a2, JILL_CH_3_N2_D_GAIN,      1},
 { INIT_WORD, 0xffff, JILL_CH_3_N2_NL_GAIN,     1},

 { INIT_PID,  0x0378, JILL_CH_1_H2_I_GAIN,      1},
 { INIT_PID,  0x0186, JILL_CH_1_H2_P_GAIN,      1},
 { INIT_PID,  0x0158, JILL_CH_1_H2_D_GAIN,      1},
 { INIT_WORD, 0xffff, JILL_CH_1_H2_NL_GAIN,     1},

 { INIT_WORD, 0x0021, JILL_CH_2_H2_I_GAIN,      0},
 { INIT_WORD, 0x0004, JILL_CH_2_H2_P_GAIN,      0},
 { INIT_WORD, 0x0003, JILL_CH_2_H2_D_GAIN,      0},
 { INIT_WORD, 0xffff, JILL_CH_2_H2_NL_GAIN,     0},

 { INIT_PID,  0x08ce, JILL_CH_3_H2_I_GAIN,      1},
 { INIT_PID,  0x06b6, JILL_CH_3_H2_P_GAIN,      1},
 { INIT_PID,  0x28dd, JILL_CH_3_H2_D_GAIN,      1},
 { INIT_WORD, 0xffff, JILL_CH_3_H2_NL_GAIN,     1},

 { INIT_PID,  0x0238, JILL_CH_1_He_I_GAIN,      1},
 { INIT_PID,  0x014c, JILL_CH_1_He_P_GAIN,      1},
 { INIT_PID,  0x0185, JILL_CH_1_He_D_GAIN,      1},
 { INIT_WORD, 0xffff, JILL_CH_1_He_NL_GAIN,     1},

 { INIT_WORD, 0x0029, JILL_CH_2_He_I_GAIN,      0},
 { INIT_WORD, 0x0005, JILL_CH_2_He_P_GAIN,      0},
 { INIT_WORD, 0x0005, JILL_CH_2_He_D_GAIN,      0},
 { INIT_WORD, 0xffff, JILL_CH_2_He_NL_GAIN,     0},

 { INIT_PID,  0x03da, JILL_CH_3_He_I_GAIN,      1},
 { INIT_PID,  0x0527, JILL_CH_3_He_P_GAIN,      1},
 { INIT_PID,  0x36e2, JILL_CH_3_He_D_GAIN,      1},
 { INIT_WORD, 0xffff, JILL_CH_3_He_NL_GAIN,     1},

 { INIT_PID,  0x0376, JILL_CH_1_ArMe_I_GAIN,    1},
 { INIT_PID,  0x01d6, JILL_CH_1_ArMe_P_GAIN,    1},
 { INIT_PID,  0x01ee, JILL_CH_1_ArMe_D_GAIN,    1},
 { INIT_WORD, 0xffff, JILL_CH_1_ArMe_NL_GAIN,   1},

 { INIT_WORD, 0x000b, JILL_CH_2_ArMe_I_GAIN,    0},
 { INIT_WORD, 0x0002, JILL_CH_2_ArMe_P_GAIN,    0},
 { INIT_WORD, 0x0003, JILL_CH_2_ArMe_D_GAIN,    0},
 { INIT_WORD, 0xffff, JILL_CH_2_ArMe_NL_GAIN,   0},

 { INIT_PID,  0x0ca1, JILL_CH_3_ArMe_I_GAIN,    1},
 { INIT_PID,  0x10d9, JILL_CH_3_ArMe_P_GAIN,    1},
 { INIT_PID,  0xb3a2, JILL_CH_3_ArMe_D_GAIN,    1},
 { INIT_WORD, 0xffff, JILL_CH_3_ArMe_NL_GAIN,   1},


 { INIT_PID,  0x07d8, JILL_CH_1_O2_I_GAIN,      1},
 { INIT_PID,  0x0126, JILL_CH_1_O2_P_GAIN,      1},
 { INIT_PID,  0x0158, JILL_CH_1_O2_D_GAIN,      1},
 { INIT_WORD, 0xffff, JILL_CH_1_O2_NL_GAIN,     1},

 { INIT_WORD, 0x00c8, JILL_CH_2_O2_I_GAIN,      0},
 { INIT_WORD, 0x0014, JILL_CH_2_O2_P_GAIN,      0},
 { INIT_WORD, 0x0012, JILL_CH_2_O2_D_GAIN,      0},
 { INIT_WORD, 0xffff, JILL_CH_2_O2_NL_GAIN,     0},

 { INIT_PID,  0x0000, JILL_CH_3_O2_I_GAIN,      1},
 { INIT_PID,  0x0000, JILL_CH_3_O2_P_GAIN,      1},
 { INIT_PID,  0x0000, JILL_CH_3_O2_D_GAIN,      1},
 { INIT_WORD, 0x0000, JILL_CH_3_O2_NL_GAIN,     1},

 { INIT_PID,  0x0c50, JILL_CH_1_Air_I_GAIN,     1},
 { INIT_PID,  0x019f, JILL_CH_1_Air_P_GAIN,     1},
 { INIT_PID,  0x01b5, JILL_CH_1_Air_D_GAIN,     1},
 { INIT_WORD, 0xffff, JILL_CH_1_Air_NL_GAIN,    1},

 { INIT_WORD, 0x002c, JILL_CH_2_Air_I_GAIN,     0},
 { INIT_WORD, 0x0007, JILL_CH_2_Air_P_GAIN,     0},
 { INIT_WORD, 0x000b, JILL_CH_2_Air_D_GAIN,     0},
 { INIT_WORD, 0xffff, JILL_CH_2_Air_NL_GAIN,    0},

 { INIT_PID,  0x0000, JILL_CH_3_Air_I_GAIN,     1},
 { INIT_PID,  0x0000, JILL_CH_3_Air_P_GAIN,     1},
 { INIT_PID,  0x0000, JILL_CH_3_Air_D_GAIN,     1},
 { INIT_WORD, 0x0000, JILL_CH_3_Air_NL_GAIN,    1},

 { END,         0,      0,      0}  };



static const UPDATE_TABLE_ENTRY  Inlet_Max_Flow_Update[] = {

  { SAVE_WORD,  0x01,   0,      0 },       /* scribble version in case of failure */
  { INIT_WORD,  0x0000, 0x01,   0 },

  { SKIP_EQ,    0x0100, 0x02,   3 },       /* if PP */
  { SKIP_EQ,    0x0110, 0x02,   2 },       /* or VI */
  { SKIP_EQ,    0x010d, 0x02,   1 },       /* or SIMDIST */
  { SKIP_NE,    0x0109, 0x02,   4 },       /* or if ACI then  */
   { INIT_WORD,    100, H2_MAX_INLET_FLOW,   0 },         /* H2  100mL */
   { INIT_WORD,    100, He_MAX_INLET_FLOW,   0 },         /* He  100mL */
   { INIT_WORD,    100, ArMe_MAX_INLET_FLOW, 0 },         /* ArMe100mL */
   { INIT_WORD,    100, N2_MAX_INLET_FLOW,   0 },         /* N2  100mL */

  { SKIP_EQ,    0x0110, 0x02,   7 },       /* if !VI      */
  { SKIP_EQ,    0x010d, 0x02,   6 },       /* if !SIMDIST */
  { SKIP_EQ,    0x0100, 0x02,   5 },       /* and !PP */
  { SKIP_EQ,    0x0109, 0x02,   4 },       /* and !ACI then */
   { INIT_WORD,   1000, H2_MAX_INLET_FLOW,   0 },         /* H2 1000mL */
   { INIT_WORD,   1000, He_MAX_INLET_FLOW,   0 },         /* He 1000mL */
   { INIT_WORD,    200, ArMe_MAX_INLET_FLOW, 0 },         /* ArMe200mL */
   { INIT_WORD,    200, N2_MAX_INLET_FLOW,   0 },         /* N2  200mL */

  { RESTORE_WORD,0,     0x01,   0 },       /* rewrite version  */

  { END,        0,      0,      0 } };



/**begin_proto**/

void WriteInletMaxFlows( U_INT8 module_number )

/**end_proto**/
{
   UpdateEeprom( module_number, (pUPDATE_TABLE)Inlet_Max_Flow_Update );
}



#if 0
static const UPDATE_TABLE_ENTRY  Inlet_Ps_Range_Update[] = {

  { SAVE_WORD,  0x01,   0,      0 },       /* scribble version in case of failure */
  { INIT_WORD,  0x0000, 0x01,   0 },

  {  SKIP_NE,    0x0001, 0x09,              2 },       /* if PSensorRange == 100 PSI */
  {  INIT_WORD, RANGE_INLET_100PSI, 0x09,   0 },           /* set range to 100 psi in IU */
  {  INIT_WORD, SCALE_INLET_100PSI, 0x18,   0 },           /* set dynes/cm2 */

  {  SKIP_NE,    0x0002, 0x09,              2 },       /* if PSensorRange == 150 PSI */
  {  INIT_WORD, RANGE_INLET_150PSI, 0x09,   0 },           /* set range in IU */
  {  INIT_WORD, SCALE_INLET_150PSI, 0x18,   0 },           /* set dynes/cm2 */

  {  SKIP_NE,    0x0003, 0x09,              2 },       /* if PSensorRange == 15 PSI */
  {  INIT_WORD, RANGE_INLET_15PSI, 0x09,    0 },           /* set range in IU */
  {  INIT_WORD, SCALE_INLET_15PSI, 0x18,    0 },           /* set dynes/cm2 */

  { RESTORE_WORD,0,     0x01,   0 },       /* rewrite version  */

  { END,        0,      0,      0 } };
#endif





extern U_INT16 EEPROM_Write_Address;
extern U_INT16 EEPROM_Write_Data;

/**begin_proto**/

BIT8 InitInletEEPROM ( U_INT8 module, U_INT16 type, U_INT16 range, U_INT16 scale, U_INT16 snh, U_INT16 snl, U_INT16 bd )

/**end_proto**/

{

     U_INT16       i;
     BIT8          ok;

     ok = TRUE;

  /* PrimitiveWriteEeprom( module, CHECKSUM, 0 );
     Inst_Status.Pneu.Module_Cksums[ module ] = 0;
  */

     for ( i = 0; i< INLET_EEPROM_SIZE; i++ )
     {
          if ( i == CHECKSUM ) continue;

          EEPROM_Write_Address = i;
          if ( (type & 0xff)  == (U_INT16)JIB )
          {
              EEPROM_Write_Data    = Jill_EEPROM_Default[ i ].value;
          }
          else
          {
              EEPROM_Write_Data    = Inlet_EEPROM_Default[ i ].value;
          }
          ok &= WriteEeprom ( module, i, EEPROM_Write_Data );
     }


     type = type | ( (U_INT16)INLET_MODULE << 8 );

     ok &= WriteEeprom( module, TYPE, type );
     ok &= WriteEeprom( module, PS_RANGE, range );
     ok &= WriteEeprom( module, P_SCALING, scale );

     ok &= WriteEeprom( module, BUILD_DATE, bd );
     ok &= WriteEeprom( module, SERIAL_NO_HIGH, snh );
     ok &= WriteEeprom( module, SERIAL_NO_LOW,  snl );

     if ( (INLET_TYPE)(type & 0xff) != JIB )
     {
         WriteInletPurgeFlows( module );
         WriteInletMaxFlows( module );
     }

     WriteInletPIDs( module, type );

     return ok;
}


/* the following definitions are if'ed out since they will be included in  */
/* proto.h.  if they were not if'ed out, we would get warnings about       */
/* redefinition on the symbols */

#if 0
/**begin_proto**/
typedef struct { U_INT8 cmd; U_INT16 source; U_INT16 dest; U_INT16 extra; } UPDATE_TABLE_ENTRY, *pUPDATE_TABLE;


#define END        0
#define COPY_WORD  1
#define COPY_ROW   2
#define COPY_BLOCK 3
#define INIT_WORD  4
#define INIT_ROW   5
#define INIT_BLOCK 6
#define MUL_DIV    7
#define SAVE_WORD  8
#define RESTORE_WORD 9
#define SKIP_EQ    10       /*  skip n lines if eq     SKIP_EQ      value,       location,           skip_count */
#define SKIP_NE    11       /*  skip n lines if ne     SKIP_NE      value,       location,           skip_count */
#define SHIFT_32   12       /*  SHIFT_32   shift count, &high word, &low word */
#define INIT_PID   13       /*  INIT_PID   100psi pid value, location, ps to use for scaling */
#define RECALIB    14
#define CALC_CKSUM 15
#define NO_OP      16
#define TO_SCCM    17
#define SKIP       18
#define SKIP_IF_OK 19

/**end_proto**/

#endif
/**begin_proto**/

void UpdateEeprom( U_INT16 module_number, pUPDATE_TABLE table )

/**end_proto**/
{
   U_INT16 index;
   U_INT16 data;
   U_INT32 ps_range[3];
   INT32   temp;
   INT32   sub_index;
   U_INT16 saved_word;
   UI_ERR  result;

   index = 0;
   saved_word = 0;

   for ( temp = 0 ; temp < 3 ; temp++ )
   {
       ReadSensorRange( module_number, temp+1, &data );
       ps_range[temp] = data;
       ReadPresScaling( module_number, temp+1, &data );
       ps_range[temp] *= data;
   }

   result = OK;

   while ( 1 )
   {
       switch ( (table+index)->cmd )
       {

           case SAVE_WORD:  (void)ReadEeprom  ( module_number, (table+index)->source, &saved_word );
                            break;

           case RESTORE_WORD: (void)WriteEeprom ( module_number, (table+index)->dest, saved_word );
                            break;

           case INIT_WORD:
                            EEPROM_Write_Address = (table+index)->dest;
                            EEPROM_Write_Data    = (table+index)->source;
                            (void)WriteEeprom ( module_number, (table+index)->dest, (table+index)->source );
                            break;

           case INIT_ROW:   for ( sub_index = 0; sub_index < 3 ; sub_index++ )
                            {
                                EEPROM_Write_Address = (table+index)->dest+sub_index;
                                EEPROM_Write_Data    = (table+index)->source;
                                (void)WriteEeprom ( module_number, (table+index)->dest+sub_index,  (table+index)->source );
                            }
                            break;

           case INIT_BLOCK: for ( sub_index = 0; sub_index < (table+index)->extra ; sub_index++ )
                            {
                                EEPROM_Write_Address = (table+index)->dest+sub_index;
                                EEPROM_Write_Data    = (table+index)->source;
                                (void)WriteEeprom ( module_number, (table+index)->dest+sub_index,   (table+index)->source );
                            }
                            break;

           case COPY_WORD:  (void)ReadEeprom  ( module_number, (table+index)->source, &data );
                            EEPROM_Write_Address = (table+index)->dest;
                            EEPROM_Write_Data    = data;
                            (void)WriteEeprom ( module_number, (table+index)->dest,    data );
                            break;

           case COPY_ROW:   for ( sub_index = 0; sub_index < 3 ; sub_index++ )
                            {
                                (void)ReadEeprom  ( module_number, (table+index)->source+sub_index, &data );
                                EEPROM_Write_Address = (table+index)->dest;
                                EEPROM_Write_Data    = data;
                                (void)WriteEeprom ( module_number, (table+index)->dest+sub_index,    data );
                            }
                            break;

           case COPY_BLOCK: if( (table+index)->source > (table+index)->dest )
                            {
                                 for ( sub_index = 0; sub_index < (table+index)->extra ; sub_index++ )
                                 {
                                     (void)ReadEeprom  ( module_number, (table+index)->source+sub_index, &data );
                                     EEPROM_Write_Address = (table+index)->dest;
                                     EEPROM_Write_Data    = data;
                                     (void)WriteEeprom ( module_number, (table+index)->dest+sub_index,    data );
                                 }
                            }
                            else
                            {
                                 for ( sub_index = (table+index)->extra -1 ; sub_index >= 0 ; sub_index-- )
                                 {
                                     (void)ReadEeprom  ( module_number, (table+index)->source+sub_index, &data );
                                     EEPROM_Write_Address = (table+index)->dest;
                                     EEPROM_Write_Data    = data;
                                     (void)WriteEeprom ( module_number, (table+index)->dest+sub_index,    data );
                                 }
                            }
                            break;

           case MUL_DIV:    (void)ReadEeprom  ( module_number, (table+index)->source, (U_INT16 *)&data );
                            data = ((U_INT32)data * (table+index)->dest ) / (table+index)->extra;
                            EEPROM_Write_Address = (table+index)->source;
                            EEPROM_Write_Data    = data;
                            (void)WriteEeprom ( module_number, (table+index)->source,    data );
                            break;

           case SKIP_EQ:    (void)ReadEeprom( module_number, (table+index)->dest, &data );
                            if ( data == (table+index)->source )
                                index += (table+index)->extra;
                            break;

           case SKIP_NE:    (void)ReadEeprom( module_number, (table+index)->dest, &data );
                            if ( data != (table+index)->source )
                                index += (table+index)->extra;
                            break;

           case SHIFT_32:   (void)ReadEeprom  ( module_number, (table+index)->dest,   (U_INT16 *)&temp );
                            (void)ReadEeprom  ( module_number, (table+index)->extra,  (U_INT16 *)&data );
                            temp = ( (temp & 0xffff0000)  |  ((U_INT32)data & 0x0000ffff) );

                            temp = temp << (table+index)->source;
                            data = ( temp & 0xffff0000 ) >> 16;
                            EEPROM_Write_Address = (table+index)->dest;
                            EEPROM_Write_Data    = data;
                            (void)WriteEeprom ( module_number, (table+index)->dest,    data );

                            data =  temp & 0x0000ffff;
                            EEPROM_Write_Address = (table+index)->extra;
                            EEPROM_Write_Data    = data;
                            (void)WriteEeprom ( module_number, (table+index)->extra,   data );
                            break;

           case INIT_PID:   if ( (table+index)->source != 0xffff )
                            {
                               data = QuadWordMultiplyDivide( (table+index)->source,
                                         ps_range[ (table+index)->extra -1 ],
                                         ( 0xa0 * 0xa854 ) );
                            }
                            else
                            {
                               data = (table+index)->source;
                            }
                            EEPROM_Write_Address = (table+index)->dest;
                            EEPROM_Write_Data    = data;
                            (void)WriteEeprom ( module_number, (table+index)->dest,    data );
                            break;

           case RECALIB:    result = RecalibFlow( module_number, (GAS_TYPE)(table+index)->source );
                            break;

           case CALC_CKSUM: data = CalcModuleChecksum( module_number );
                            (void)PrimitiveWriteEeprom ( module_number, CHECKSUM, data );
                            break;

           case NO_OP:      break;

           case TO_SCCM:    (void)ReadEeprom  ( module_number, (table+index)->dest, (U_INT16 *)&data );
                            data = ((INT32)((INT16)data) * 27315 ) / 29815;
                            EEPROM_Write_Address = (table+index)->source;
                            EEPROM_Write_Data    = data;
                            (void)WriteEeprom ( module_number, (table+index)->dest,    data );
                            break;

           case SKIP:       index += (table+index)->extra;
                            break;

           case SKIP_IF_OK: if ( result == OK ) index += (table+index)->extra;
                            break;


           case END:  return; /* blast all the way outa here! */
           default:   return;

       } /* switch */

       index++;

   }  /* while */

}

/***********************************************************************/
/* FUNCTION: GetSSPidTable                                             */
/* ========                                                            */
/*                                                                     */
/* PURPOSE: returns a pointer to the needed S/SL inlet PID table       */
/*          as per max pressure in effect                              */
/*                                                                     */
/***********************************************************************/
/**begin_proto**/

pUPDATE_TABLE GetSSPidTable( U_INT16 modul_num )

/**end_proto**/

{
     U_INT16 scale;
     U_INT16 range;

     (void)ReadEeprom ( modul_num, PS_RANGE, &range );
     (void)ReadEeprom ( modul_num, P_SCALING, &scale );

     if ( (range == RANGE_INLET_150PSI) && (scale == SCALE_INLET_150PSI) ) return (pUPDATE_TABLE) INIT_SS150_PID_TABLE;
     if ( (range&0xfff0 == RANGE_INLET_15PSI&0xfff0 ) && (scale == SCALE_INLET_15PSI ) )
                                                                   return (pUPDATE_TABLE) INIT_SS15_PID_TABLE;
     /* else ASSUME that inlet was a 100 PSI type ; this allows either A855 or A854  as range parm */
     return (pUPDATE_TABLE) INIT_SS100_PID_TABLE;
}

static const UPDATE_TABLE_ENTRY  I_0107_Update[] = {

  { SAVE_WORD, 0x02,   0,      0 },       /* save the module type word */
  { INIT_WORD, 0xffff, 0x02,   0 },       /* scribble module type in case of failure */

  { INIT_WORD, 0x2ccc, 0x06,   0 },      /* a delta volts term for the thermistor */
  { INIT_WORD, 0x0780, 0x07,   0 },      /* a delta temp term for the thermistor */

  { COPY_ROW,  0x60,   0x72,   0 },      /* n2   dx_dT terms */
  { COPY_ROW,  0x5d,   0x6f,   0 },      /* n2 alpha beta and offset -> xxx high */
  { INIT_WORD, 0xffff, 0x6e,   0 },      /* n2 set the high low flow to -1 (always use low flow) */
  { COPY_ROW,  0x5d,   0x6c,   0 },      /* n2 alpha beta and offset -> xxx low */

  { COPY_ROW,  0x5a,   0x69,   0 },      /* ArMe   dx_dT terms */
  { COPY_ROW,  0x57,   0x66,   0 },      /* ArMe alpha beta and offset -> xxx high */
  { INIT_WORD, 0xffff, 0x65,   0 },      /* ArMe set the high low flow to -1 (always use low flow) */
  { COPY_ROW,  0x57,   0x63,   0 },      /* ArMe alpha beta and offset -> xxx low */

  { COPY_ROW,  0x54,   0x60,   0 },      /* He   dx_dT terms */
  { COPY_ROW,  0x51,   0x5d,   0 },      /* He alpha beta and offset -> xxx high */
  { INIT_WORD, 0xffff, 0x5c,   0 },      /* He set the high low flow to -1 (always use low flow) */
  { COPY_ROW,  0x51,   0x5a,   0 },      /* He alpha beta and offset -> xxx low */

  { COPY_ROW,  0x4e,   0x57,   0 },      /* Ar   dx_dT terms */
  { COPY_ROW,  0x4b,   0x54,   0 },      /* Ar alpha beta and offset -> xxx high */
  { INIT_WORD, 0xffff, 0x53,   0 },      /* Ar set the high low flow to -1 (always use low flow) */
  { COPY_ROW,  0x4b,   0x51,   0 },      /* Ar alpha beta and offset -> xxx low */

  { COPY_ROW,  0x48,   0x4e,   0 },      /* H2   dx_dT terms */
  { COPY_ROW,  0x45,   0x4b,   0 },      /* H2 alpha beta and offset -> xxx high */
  { INIT_WORD, 0xffff, 0x4a,   0 },      /* H2 set the high low flow to -1 (always use low flow) */
  { COPY_ROW,  0x45,   0x48,   0 },      /* H2 alpha beta and offset -> xxx low */

  { COPY_BLOCK,0x3f,   0x42,   6 },      /* H2 factory calib  */

  { COPY_ROW,  0x3c,   0x7d,   0 },      /* save the offset temp gains  */

  { COPY_BLOCK,0x21,   0x27,   27},      /* user calib and user pids */

  { INIT_ROW,  0x0000, 0x24,   0 },      /* dSpan_dT */

  { COPY_ROW,  0x1e,   0x21,   0 },      /* span */

  { COPY_ROW,  0x7d,   0x1e,   0 },      /* previously saved dOffset_dT */

  { INIT_WORD, 0x0107, 0x01,   0 },      /* update the version field */

  { RESTORE_WORD, 0,   0x02,   0 },      /* return the module type word */

  { END,       0,      0,      0 } };



/**begin_proto**/

void UpdateInletEeprom0107( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0107_Update );

}

static const UPDATE_TABLE_ENTRY  I_0109_Update[] = {
  { INIT_WORD, 0x0109, 0x01,   0 },      /* update the version field */
  { END,       0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0109( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0109_Update );

}


static const UPDATE_TABLE_ENTRY  I_010A_Update[] = {
  { INIT_WORD, 0x010a, 0x01,   0 },      /* update the version field */
  { END,       0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom010A( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_010A_Update );

}


static const UPDATE_TABLE_ENTRY  I_010B_Update[] = {

  { INIT_WORD, 0xff0b, 0x01,   0 },       /* scribble version in case of failure */

  { COPY_BLOCK,0xae,   0xba,   9 },       /* move the N2 flow sensor parms */
  { COPY_BLOCK,0xa5,   0xae,   9 },       /* move the ArMe flow sensor parms */
  { COPY_BLOCK,0x9c,   0xa2,   9 },       /* move the He flow sensor parms */
  { COPY_BLOCK,0x93,   0x96,   9 },       /* move the Ar flow sensor parms */

  { INIT_WORD, 0x4a89, 0x93,   0 },       /* the reference temp for the H2 fs parms */
  { INIT_WORD, 0x4a89, 0x9f,   0 },       /* the reference temp for the Ar fs parms */
  { INIT_WORD, 0x4a89, 0xab,   0 },       /* the reference temp for the He fs parms */
  { INIT_WORD, 0x4a89, 0xb7,   0 },       /* the reference temp for the ArMe fs parms */
  { INIT_WORD, 0x4a89, 0xc3,   0 },       /* the reference temp for the N2 fs parms */

  { SKIP_NE,   0x0100, 0x02,   5 },       /* skip if not pp */
  { INIT_WORD, 0x0100, 0x94,   0 },           /* init H2 septum purge flow */
  { INIT_WORD, 0x0100, 0xa0,   0 },           /* init Ar septum purge flow */
  { INIT_WORD, 0x0100, 0xac,   0 },           /* init He septum purge flow */
  { INIT_WORD, 0x0100, 0xb8,   0 },           /* init ArMe septum purge flow */
  { INIT_WORD, 0x0100, 0xc4,   0 },           /* init N2 septum purge flow */

  { SKIP_NE,   0x0101, 0x02,   5 },       /* skip if not COC */
  { INIT_WORD, 0x0f00, 0x94,   0 },           /* init H2 septum purge flow */
  { INIT_WORD, 0x0f00, 0xa0,   0 },           /* init Ar septum purge flow */
  { INIT_WORD, 0x0f00, 0xac,   0 },           /* init He septum purge flow */
  { INIT_WORD, 0x0f00, 0xb8,   0 },           /* init ArMe septum purge flow */
  { INIT_WORD, 0x0f00, 0xc4,   0 },           /* init N2 septum purge flow */

  { SKIP_NE,   0x0102, 0x02,   5 },       /* skip if not ss */
  { INIT_WORD, 0x0300, 0x94,   0 },           /* init H2 septum purge flow */
  { INIT_WORD, 0x0300, 0xa0,   0 },           /* init Ar septum purge flow */
  { INIT_WORD, 0x0300, 0xac,   0 },           /* init He septum purge flow */
  { INIT_WORD, 0x0300, 0xb8,   0 },           /* init ArMe septum purge flow */
  { INIT_WORD, 0x0300, 0xc4,   0 },           /* init N2 septum purge flow */

  { INIT_WORD, 0x0000, 0x95,   0 },           /* init H2 d purge / d pres  */
  { INIT_WORD, 0x0000, 0xa1,   0 },           /* init Ar d purge / d pres  */
  { INIT_WORD, 0x0000, 0xad,   0 },           /* init He d purge / d pres  */
  { INIT_WORD, 0x0000, 0xb9,   0 },           /* init ArMe d purge / d pres  */
  { INIT_WORD, 0x0000, 0xc5,   0 },           /* init N2 d purge / d pres  */

  { INIT_WORD, 0x010b, 0x01,   0 },      /* update the version field */

  { END,       0,      0,      0 } };



/**begin_proto**/

void UpdateInletEeprom010B( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_010B_Update );

}


static const UPDATE_TABLE_ENTRY  I_010C_Update[] = {
  { INIT_WORD, 0x010c, 0x01,   0 },      /* update the version field */
  { END,       0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom010C( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_010C_Update );

}


static const UPDATE_TABLE_ENTRY  I_010D_Update[] = {

  { INIT_WORD,  0xff0c, 0x01,   0 },       /* scribble version in case of failure */

  { COPY_BLOCK, 0xba,   0xcc,  12 },       /* move the N2 flow sensor parms */
  { COPY_BLOCK, 0xae,   0xbd,  12 },       /* move the ArMe flow sensor parms */
  { COPY_BLOCK, 0xa2,   0xae,  12 },       /* move the He flow sensor parms */
  { COPY_BLOCK, 0x96,   0x9f,  12 },       /* move the Ar flow sensor parms */
  { COPY_BLOCK, 0x8a,   0x90,  12 },       /* move the H2 flow sensor parms */

  { COPY_BLOCK, 0x2a,   0x30,  96 },       /* move the PID terms */
  { COPY_BLOCK, 0x18,   0x1e,  18 },       /* move the caib constants */

  { INIT_BLOCK, 0,      0x18,   6 },       /* init the scaling fields */

  { INIT_WORD,  0x000e, 0x1c,   0 },       /* inlet flow IU_Scaling bits */
  { INIT_WORD,  0x0008, 0x1d,   0 },       /* septum purge regulator flow scaling */

  { INIT_WORD,  0x010d, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };



/**begin_proto**/

void UpdateInletEeprom010D( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_010D_Update );

}



static const UPDATE_TABLE_ENTRY  I_010E_Update[] = {

  { INIT_WORD,  0x0008, 0x1d,   0 },       /* write out the scaling for spr */

  { INIT_WORD,  0x010e, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };


/**begin_proto**/

void UpdateInletEeprom010E( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_010E_Update );

}


static const UPDATE_TABLE_ENTRY  I_010F_Update[] = {

  { INIT_WORD,  0x010f, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom010F( pINLET_STATUS status )

/**end_proto**/
{
   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_010F_Update );

   /* only change is the non linear pid's */

}

static const UPDATE_TABLE_ENTRY  I_Purge_Flows[] = {

  { SKIP_NE,   0x010f, 0x02,   1 },       /* bust out of here if this is a jill. */
    { END,     0,      0,      0 },

  { SKIP_EQ,   0x010d, 0x02,   5 },       /* Skip if SIMDIST */
  { SKIP_NE,   0x0100, 0x02,   4 },       /* or Skip if NOT PP else fall thru if IS a PP */
  { INIT_WORD, 0x0100, H2_PURGE_FLOW,   0 },           /* init H2 PP septum purge flow */
  { INIT_WORD, 0x0100, He_PURGE_FLOW,   0 },           /* init He PP septum purge flow */
  { INIT_WORD, 0x0100, ArMe_PURGE_FLOW, 0 },           /* init ArMe PP septum purge flow */
  { INIT_WORD, 0x0100, N2_PURGE_FLOW,   0 },           /* init N2 PP septum purge flow */

  { SKIP_NE,   0x0101, 0x02,   4 },       /* skip if not COC */
  { INIT_WORD, 0x0f00, H2_PURGE_FLOW,   0 },           /* init H2 COC septum purge flow */
  { INIT_WORD, 0x0f00, He_PURGE_FLOW,   0 },           /* init He COC septum purge flow */
  { INIT_WORD, 0x0f00, ArMe_PURGE_FLOW, 0 },           /* init ArMe COC septum purge flow */
  { INIT_WORD, 0x0f00, N2_PURGE_FLOW,   0 },           /* init N2 COC septum purge flow */

  { SKIP_EQ,    0x010e, 0x02,   3 },       /* if CIS3 */
  { SKIP_EQ,    0x010c, 0x02,   2 },       /* or CIS4 */
  { SKIP_EQ,    0x0110, 0x02,   1 },       /* or VI   */
  { SKIP_NE,    0x0102, 0x02,   4 },       /* or SS fall thru w/ "other" else skip */
  { INIT_WORD, 0x0300, H2_PURGE_FLOW,   0 },           /* init H2 "other" septum purge flow */
  { INIT_WORD, 0x0300, He_PURGE_FLOW,   0 },           /* init He "other" septum purge flow */
  { INIT_WORD, 0x0300, ArMe_PURGE_FLOW, 0 },           /* init ArMe "other" septum purge flow */
  { INIT_WORD, 0x0300, N2_PURGE_FLOW,   0 },           /* init N2 "other" septum purge flow */

  { INIT_WORD, 0x0000, H2_dPURGE_dP,   0 },           /* init H2 d purge / d pres  */
  { INIT_WORD, 0x0000, He_dPURGE_dP,   0 },           /* init He d purge / d pres  */
  { INIT_WORD, 0x0000, ArMe_dPURGE_dP, 0 },           /* init ArMe d purge / d pres  */
  { INIT_WORD, 0x0000, N2_dPURGE_dP,   0 },           /* init N2 d purge / d pres  */

  { END,       0,      0,      0 } };


/**begin_proto**/

void WriteInletPurgeFlows( U_INT8 module_number )

/**end_proto**/
{

    UpdateEeprom( module_number, (pUPDATE_TABLE)I_Purge_Flows );

}


/***********************************************************************/
/* FUNCTION:                                                           */
/* ========                                                            */
/*                                                                     */
/* PURPOSE:                                                            */
/*                                                                     */
/* RETURNED VALUE:                                                     */
/*                                                                     */
/* GLOBALS USED:                                                       */
/*                                                                     */
/***********************************************************************/


/**begin_proto**/

void WriteInletPIDs( U_INT8 module_number, U_INT16 type )

/**end_proto**/
{

   switch ( type & 0x00ff )
   {
      case JIB:UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_JILL_PID_TABLE );
               break;

      case PP: UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_PP_PID_TABLE );
               break;

      case ACI:UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_ACI_PID_TABLE );
               break;

      case SIMDIST:
               UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_ACI_PID_TABLE );
               break;

      case PTV:UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_PTV_PID_TABLE );
               break;

      case G_PTV:UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_G_PTV_PID_TABLE );
               break;

      case COC:UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_COC_PID_TABLE );
               break;

      case SS: UpdateEeprom( module_number, GetSSPidTable(module_number)  );
               break;

      case CIS3 :UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_CIS3_PID_TABLE );
               break;

      case CIS4 :UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_CIS4_PID_TABLE );
               break;

      case VOLATILES:
               UpdateEeprom( module_number, (pUPDATE_TABLE)INIT_VI_PID_TABLE );
               break;

   }

}

/***********************************************************************/
/* FUNCTION:                                                           */
/* ========                                                            */
/*                                                                     */
/* PURPOSE:                                                            */
/*                                                                     */
/* RETURNED VALUE:                                                     */
/*                                                                     */
/* GLOBALS USED:                                                       */
/*                                                                     */
/***********************************************************************/
/**begin_proto**/

UI_ERR GetInletEepromDef (U_INT16 address, BIT8 *definition )

/**end_proto**/
{

    U_INT8 i;
    BIT8   *source, *dest;

    if ( address >= INLET_EEPROM_SIZE ) return INVALID_PARAM;

    source = (BIT8 *)Inlet_EEPROM_Default[address].definition;
    dest   = definition;

    for ( i = 0 ; i < EEPROM_DEF_SIZE ; i++ )  *dest++ = *source++;

    return OK;
}


/**begin_proto**/

UI_ERR GetJillEepromDef (U_INT16 address, BIT8 *definition )

/**end_proto**/
{

    U_INT8 i;
    BIT8   *source, *dest;

    if ( address >= INLET_EEPROM_SIZE ) return INVALID_PARAM;

    source = (BIT8 *)Jill_EEPROM_Default[address].definition;
    dest   = definition;

    for ( i = 0 ; i < EEPROM_DEF_SIZE ; i++ )  *dest++ = *source++;

    return OK;
}


static const UPDATE_TABLE_ENTRY  I_0110_Update[] = {

  { COPY_BLOCK, 0xae,   0x9f,  15 },       /* move the He block  */
  { COPY_BLOCK, 0xbd,   0xae,  15 },       /* move the ArMe block  */
  { COPY_BLOCK, 0xcc,   0xbd,  15 },       /* move the N2 block  */
  { INIT_BLOCK, 0,      0xcc,  52 },       /* init the saved voltage block */

  { INIT_WORD,  0x0110, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0110( pINLET_STATUS status )

/**end_proto**/
{
   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0110_Update );

}


static const UPDATE_TABLE_ENTRY  I_0111_Update[] = {

  { INIT_WORD,  0x0111, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0111( pINLET_STATUS status )

/**end_proto**/
{

   /* only change is the non linear pid's */

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0111_Update );
}



static const UPDATE_TABLE_ENTRY  I_0112_Update[] = {

  /* scale alpha low and beta low to represent signed integers */

  { MUL_DIV,    0x0090,    1,   2 },       /*  divide H2 alpha low by 2  */
  { MUL_DIV,    0x0091,    1,   2 },       /*  divide H2 alpha low by 2  */

  { MUL_DIV,    0x009f,    1,   2 },       /*  divide He alpha low by 2  */
  { MUL_DIV,    0x00a0,    1,   2 },       /*  divide He alpha low by 2  */

  { MUL_DIV,    0x00ae,    1,   2 },       /*  divide ArMe alpha low by 2  */
  { MUL_DIV,    0x00af,    1,   2 },       /*  divide ArMe alpha low by 2  */

  { MUL_DIV,    0x00bd,    1,   2 },       /*  divide N2 alpha low by 2  */
  { MUL_DIV,    0x00be,    1,   2 },       /*  divide N2 alpha low by 2  */

  { INIT_WORD,  0x0112, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0112( pINLET_STATUS status )

/**end_proto**/
{

   /* only change is the non linear pid's */


   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0112_Update );
}

static const UPDATE_TABLE_ENTRY  I_0113_Update[] = {

  /* scale alpha low and beta low to represent signed integers */

  { SKIP_NE,    0x010f, 0x02,   2 },       /* if not a Jill, skip this update    */

  { COPY_BLOCK, 0x0090, 0x60,  60 },       /*  copy all of the flow sensor parms */
  { COPY_BLOCK, 0x00cc, 0xc0,  36 },       /*  copy all of the saved voltages    */


  { NO_OP,      0x0000, 0x00,   0 },       /* really a noop */

  { INIT_WORD,  0x0113, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0113( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0113_Update );
}

static const UPDATE_TABLE_ENTRY  I_0114_Update[] = {

  /* scale alpha low and beta low to represent signed integers */

  { CALC_CKSUM, 0,      0,      0 },       /* calc and write the module cksum    */

  { SKIP_EQ,    0x010f, 0x02,   3 },      /* if JILL, skip */
  { INIT_WORD,  0,      0x1e,   0 },      /* user calib state */
  { INIT_WORD,  0,      0x1f,   0 },      /* user calib date1 */
  { INIT_WORD,  0,      0x20,   0 },      /* user calib date2 */

  { INIT_WORD,  0x0114, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0114( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0114_Update );
}

static const UPDATE_TABLE_ENTRY  I_0115_Update[] = {

  { SKIP_NE,    0x010f, 0x02,   2 },      /* if ! JILL, skip */
  { INIT_WORD,  0xdead, 0x01,   0 },
  { END,        0,         0,   0 },      /* cant update a jill this time */

  { TO_SCCM,    0,      0xcc, 0 },
  { TO_SCCM,    0,      0xd5, 0 },
  { TO_SCCM,    0,      0xde, 0 },
  { TO_SCCM,    0,      0xe7, 0 },


  { SKIP_EQ,    0x0101, 0x02,  13 },      /* this update does not effect COC's  */


  { RECALIB,    0,         0,   0 },      /* Recalib flow sensor for N2 */
  { SKIP_IF_OK, 0,         0,   1 },
  { INIT_WORD,  0xdead, 0x01,   0 },

  { RECALIB,    1,         0,   0 },      /* Recalib flow sensor for H2 */
  { SKIP_IF_OK, 0,         0,   1 },
  { INIT_WORD,  0xdead, 0x01,   0 },

  { RECALIB,    2,         0,   0 },      /* Recalib flow sensor for He */
  { SKIP_IF_OK, 0,         0,   1 },
  { INIT_WORD,  0xdead, 0x01,   0 },

  { RECALIB,    3,         0,   0 },      /* Recalib flow sensor for ArMe */
  { SKIP_IF_OK, 0,         0,   1 },
  { INIT_WORD,  0xdead, 0x01,   0 },


  { SKIP_EQ,    0xdead, 0x01,   1 },
  { INIT_WORD,  0x0115, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0115( pINLET_STATUS status )

/**end_proto**/
{
   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0115_Update );
}


static const UPDATE_TABLE_ENTRY  I_0116_Update[] = {

  { INIT_WORD,  0x0116, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0116( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0116_Update );
}



static const UPDATE_TABLE_ENTRY  I_0117_Update[] = {

  { INIT_WORD,  0x0117, 0x01,   0 },       /* write new version  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0117( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0117_Update );
}


static const UPDATE_TABLE_ENTRY  I_0118_Update[] = {

  { INIT_WORD,  0x0118, 0x01,   0 },       /* write new version  */

  { INIT_BLOCK, 0x0000, 0xf0,   6 },       /* erase the auto cal offset block  */

  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0118( pINLET_STATUS status )

/**end_proto**/
{

   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0118_Update );
}


static const UPDATE_TABLE_ENTRY  I_0200_Update[] = {

  { INIT_WORD,  0x004b, 0x16,   0 },       /* flow sensor auto zero delay */
  { INIT_WORD,  0x0200, 0x01,   0 },       /* write new version  */


  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0200( pINLET_STATUS status )

/**end_proto**/
{

   WriteInletPIDs( status->Module_Number, (U_INT16)status->Config->Type );
   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0200_Update );
}


static const UPDATE_TABLE_ENTRY  I_0201_Update[] = {

  { INIT_WORD,  0x0201, 0x01,   0 },       /* write new version  */
  { END,        0,      0,      0 } };

/**begin_proto**/

void UpdateInletEeprom0201( pINLET_STATUS status )

/**end_proto**/
{

   WriteInletPIDs( status->Module_Number, (U_INT16)status->Config->Type );
   UpdateEeprom( status->Module_Number, (pUPDATE_TABLE)I_0201_Update );
}
